コード例 #1
0
 public ActionResult EditPrivilege(int id)
 {
     if (User.Identity.IsAuthenticated && User.IsInRole("Admin"))
     {
         Privilege privilege = StatementManager.GetPrivilegeById(id);
         return(View(privilege));
     }
     return(RedirectToAction("Index", "Home"));
 }
コード例 #2
0
 public ActionResult RemovePrivilege(int id)
 {
     if (User.Identity.IsAuthenticated && User.IsInRole("Admin"))
     {
         return(View(new RemovePrivilegeViewModel {
             Id = id, Value = StatementManager.GetPrivilegeById(id).Value
         }));
     }
     return(RedirectToAction("Index", "Home"));
 }
コード例 #3
0
 public ActionResult RemovePrivilege(RemovePrivilegeViewModel model)
 {
     if (User.Identity.IsAuthenticated && User.IsInRole("Admin"))
     {
         if (StatementManager.GetPrivilegeById(model.Id) != null)
         {
             StatementManager.RemovePrivilege(model.Id);
         }
         return(RedirectToAction("Privileges", "Admin"));
     }
     return(RedirectToAction("Index", "Home"));
 }