I want to display User FirstName
from database when user logs on. Currently It displays UserName
which is email Id
. In Account Controller
, I have written this code to get User FirstName
from database based on User Login.
In Account Controller
:
case SignInStatus.Success:
AdvertiserDBEntities ade = new AdvertiserDBEntities();
string username = ade.UserInfoes
.Single(x => x.UserName == model.Email)
.FirstName
.ToString();
ViewBag.FirstName = username;
return RedirectToLocal(returnUrl);
In partial view _LoginPartial
:
@Html.ActionLink("Hello " + (string)ViewBag.FirstName + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" })
But I am not getting the name which I passed it from Account Controller. Please help me. Thank you in advance.