I have just added custom properties to the ApplicationUser class, which has worked and the database is now storing those properties. However, I am not sure how to display these properties on the MVC view.
This is my application user class:
using System;
using Microsoft.AspNetCore.Identity;
namespace IssueTracker.Areas.Identity.Data
{
public class ApplicationUser : IdentityUser
{
public String? FirstName { get; set; }
public String? LastName { get; set; }
public int? RoleNumber { get; set; }
}
}
Originally, my _LoginPartial.cshtml references the Identity name through this line:
@User.Identity?.Name
How can I change this to show the FirstName property? Additionally, how can I change this so that I can access all 3 properties from the ApplicationUser class on any view or partial view?
I have tried looking at other posts, but most are outdated and did not work. Thank you! I am new to MVC, so forgive me if my question is simple or if I come across as a starter.