我在IdentityUser中添加了一个名为ClientID的属性,它与FK的表客户端正确相关。
现在我想用他的客户名称(来自Clients表)来检索用户。 如何在context.Users中创建Include函数?
public ActionResult Users(string filter = "all")
{
context = new IdentityContext();
var allusers = context.Users.ToList();
List<UserViewModel> model = allusers.Select(user => new UserViewModel { Username = user.UserName,FullName=user.FirstName + " "+ user.LastName, Id = user.Id, Roles = string.Join(",", UserManager.GetRoles(user.Id))}).ToList();
return View(model);
}