How do i display a list of Users and their Roles in ASP.NET Identity 2.0.
Example...
John Doe - Admin Bob Smith - User
So far I have created a UserRoleViewModel
public string fname { get; set; }
public string rname { get; set; }
In the controller, I have done the following...
ApplicationDbContext db = new ApplicationDbContext();
UserRoleViewModel obj = new UserRoleViewModel();
var result = from u in db.Users
select new UserRoleViewModel
{
fname = u.FirstName,
rname = ???
};
return View(result);
Is this the correct approach ? If yes, how do i get the role for the user in rname ?