<div>Hello I am trying to create 2 tables one with users wich is already working and one with Roles</div> <div> </div> <div>View: the bottom table is working well, only the "applicationRoles" is not </div> <div>
public class ApplicationRole : IdentityRole<Guid>
{
public string Description { get; set; }
}
viewmodel:</div> <div>
public class AdminDetailsViewModel
{
public List<ApplicationUser> application { get; set; }
public List<ApplicationRole> applicationRoles { get; set; }
}
Controller:</div> <div></div> <div>
public async Task<IActionResult> Index()
{
var app = from m in _context.Users
select m;
var approle = from m in _context.UserRoles
select m;
var Admininfo = new AdminDetailsViewModel
{
application = await app.ToListAsync(),
applicationRoles = await approle.ToListAsync() // I get a error here
};
return View(Admininfo);
}
Im not really sure how i should handle this </div>
Member
2 Points
7 Posts
Trying to make a viewmodel with custom IdentityRole
Mar 27, 2021 12:55 AM|osyris|LINK
All-Star
53641 Points
24010 Posts
Re: Trying to make a viewmodel with custom IdentityRole
Mar 27, 2021 11:15 AM|mgebhard|LINK
What is the error?