diff options
| author | Michael <[email protected]> | 2017-05-22 21:34:35 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-22 21:34:35 -0400 |
| commit | afa3271c8f8a3dab5715fa01a333d1c541e94ce0 (patch) | |
| tree | b9344a216becb7eccc5a15fd223e762b8af4b693 | |
| parent | 3e9e9b5e9c1ded79f056c38a17d5615429059915 (diff) | |
| download | project-unite-afa3271c8f8a3dab5715fa01a333d1c541e94ce0.tar.gz project-unite-afa3271c8f8a3dab5715fa01a333d1c541e94ce0.tar.bz2 project-unite-afa3271c8f8a3dab5715fa01a333d1c541e94ce0.zip | |
removeuserfromrole
| -rw-r--r-- | Project-Unite/Controllers/AdminController.cs | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ namespace Project_Unite.Controllers return RedirectToAction("Index", new { id = "roles" }); } + public ActionResult RemoveUserFromRole(string id, string usr) + { + var usermanager = HttpContext.GetOwinContext().Get<ApplicationUserManager>(); + 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(); |
