mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 03:11:48 -05:00
removeuserfromrole
This commit is contained in:
parent
3e9e9b5e9c
commit
afa3271c8f
1 changed files with 15 additions and 0 deletions
|
@ -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<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();
|
||||
|
|
Loading…
Reference in a new issue