In my ASP.NET Core 1.1.1
app with Identity 3.0
, I've extended the default ApplicationUser
class as follows. In my following Index
view I'm displaying the userName
on top bar by using @User.Identity.Name
. Question: How can I display the user's full name instead using UserFullName
property below?
public class ApplicationUser : IdentityUser
{
public string UserName { get; set; }
[Column(TypeName = "varchar(45)")]
public string UserFullName { get; set; }
[Column(TypeName = "varchar(15)")]
}
Index.cshtml
@using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager
@if (SignInManager.IsSignedIn(User))
{
Hello @User.Identity.Name
...
}
UPDATE
The ASPNETUsers
table is already populated with UserName
and UserFullName
columns and have their values i.e. JSmith, John Smith
, BDoe, Bob Doe
, etc. So the question is if JSmith
is logged in user, we can display his user Hello JSmith as @User.Identity.Name
. But how do I display John Smith