From 6d3cbbc1cd1babde3a29415cfed91e19190051b9 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 22 May 2017 21:25:53 -0400 Subject: [PATCH] nullreference MY ASS --- Project-Unite/Controllers/AdminController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Project-Unite/Controllers/AdminController.cs b/Project-Unite/Controllers/AdminController.cs index 9ec9a81..c5d54a7 100644 --- a/Project-Unite/Controllers/AdminController.cs +++ b/Project-Unite/Controllers/AdminController.cs @@ -40,6 +40,8 @@ public ActionResult AddUserToRole(string id) Text = converted.Name, Value = converted.Name }); + if (converted.Id == id) + model.RoleId = converted.Name; } model.Users = new List(); foreach(var u in db.Users.OrderBy(x => x.DisplayName).ToArray()) @@ -50,7 +52,7 @@ public ActionResult AddUserToRole(string id) Value = u.Id }); } - model.RoleId = id; + model.Username = db.Users.First().Id; return View(model); }