I have a model which holds information about a user of this application
public class ApplicationUser : IdentityUser
{
public string Name { get; set; }
public string Payroll { get; set; }
}
I have a view model which should show some information about the a user and their role
public class VM_UserAdmin
{
public string Name { get; set; }
public string Payroll { get; set; }
public string Email { get; set; }
public string Role { get; set; }
}
I can get the name, payroll, email as properties of ApplicationUser no problems with this:
return await _applicationDbContext.Users.ToListAsync();
where _applicationDbContext is my database context.
Can anyone tell me how to reach Roles so I can include this in my VM_UserAdmin model. User.Roles... is no longer available to me in asp.net core 2.1. I have a 1-to-1 relationship of User and Role.
Thanks.