public ActionResult RoleEdit(RoleViewModel model) { if(ModelState.IsValid) { RolesManager.ChangeRole(model.RoleId, model.PermissionBrowse, model.PermissionEdit, model.PermissionDelete); return RedirectToAction("Roles"); } else return View(); }
public ActionResult RoleEdit(int id) { RoleViewModel roleViewModel = new RoleViewModel(); Role role = RolesManager.GetRole(id); if (role != null) { roleViewModel.RoleId = id; roleViewModel.PermissionBrowse = role.Permission.PermissionBrowse; roleViewModel.PermissionEdit = role.Permission.PermissionEdit; roleViewModel.PermissionDelete = role.Permission.PermissionDelete; roleViewModel.PermissionPaths = role.Permission.PermissionPaths; return View(roleViewModel); } else { return RedirectToAction("Index", "Error"); } }
public ActionResult Roles(RoleViewModel model) { return View(RolesManager.GetAllRoles()); }