mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00: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" });
|
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)
|
public ActionResult RoleDetails(string id)
|
||||||
{
|
{
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
|
|
Loading…
Reference in a new issue