nullreference MY ASS

This commit is contained in:
Michael 2017-05-22 21:25:53 -04:00
parent 6623a72766
commit 6d3cbbc1cd

View file

@ -40,6 +40,8 @@ public ActionResult AddUserToRole(string id)
Text = converted.Name, Text = converted.Name,
Value = converted.Name Value = converted.Name
}); });
if (converted.Id == id)
model.RoleId = converted.Name;
} }
model.Users = new List<SelectListItem>(); model.Users = new List<SelectListItem>();
foreach(var u in db.Users.OrderBy(x => x.DisplayName).ToArray()) foreach(var u in db.Users.OrderBy(x => x.DisplayName).ToArray())
@ -50,7 +52,7 @@ public ActionResult AddUserToRole(string id)
Value = u.Id Value = u.Id
}); });
} }
model.RoleId = id; model.Username = db.Users.First().Id;
return View(model); return View(model);
} }