This commit is contained in:
Michael 2017-03-26 12:41:45 -04:00
parent 5ddc948f4e
commit 8c265ebf36

View file

@ -588,7 +588,7 @@ public ActionResult AddUserToRole(string id = "")
public async Task<ActionResult> AddUserToRole(AddUserToRoleViewModel model)
{
var r = db.Roles.FirstOrDefault(role => role.Id == model.RoleId);
var user = db.Users.FirstOrDefault(u => u.DisplayName == model.Username);
var user = db.Users.FirstOrDefault(u => u.Id == model.Username);
var uMan = HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
var isInRole = await uMan.IsInRoleAsync(user.Id, r.Name);