diff --git a/Project-Unite/Controllers/AdminController.cs b/Project-Unite/Controllers/AdminController.cs index 57bd245..91cbf81 100644 --- a/Project-Unite/Controllers/AdminController.cs +++ b/Project-Unite/Controllers/AdminController.cs @@ -65,6 +65,21 @@ public ActionResult AddUserToRole(AddUserToRoleViewModel model) return RedirectToAction("Index", new { id = "roles" }); } + public ActionResult RemoveUserFromRole(string id, string usr) + { + var usermanager = HttpContext.GetOwinContext().Get(); + var db = new ApplicationDbContext(); + Role role = null; + foreach (var r in db.Roles) + { + if (r is Role) + if ((r as Role).Id == id) + role = r as Role; + } + usermanager.RemoveFromRole(usr, role.Name); + return RedirectToAction("Index", new { id = "roles" }); + } + public ActionResult RoleDetails(string id) { var db = new ApplicationDbContext();