Extending the UserManager
14
In my .NET Core 2.0 MVC project I added additional values to extend the ApplicationUser
public class ApplicationUser : IdentityUser
{
public string Name { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateUpdated { get; set; }
public DateTime LastLogin{ get; set; }
}
In _LoginPartial I would like to get the Name, instead of the UserName which it gets by default
@using Microsoft.AspNetCore.Identity
@using RioTintoQRManager.Models
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@if (SignInManager.IsSignedIn(User))
{
@UserManager.GetUserName(User)
}
How do I extend the UserManager, or create a new method that would be available in the view like UserManager.GetUserName is?