public IActionResult OnPost(List <int> SelectedPermission) { if (!ModelState.IsValid) { return(Page()); } _permissionService.AddRole(Role); _permissionService.AddPermissionToRoles(Role.RoleID, SelectedPermission); return(RedirectToPage("Index")); }
public IActionResult OnPost(List <int> SelectedPermission) { if (!ModelState.IsValid) { return(Page()); } Role.IsDelete = false; int roleId = _permissionService.AddRole(Role); _permissionService.AddPermissionToRole(roleId, SelectedPermission); return(RedirectToPage("Index")); }
public IActionResult CreateRole(CreateRoleViewModel model, List <int> SelectedPermission) { if (!ModelState.IsValid) { return(View(model)); } Role role = new Role() { IsDelete = false, RoleTitle = model.RoleTitle }; int roleId = _permissionService.AddRole(role); model.SelectedPermission.Select(p => p.PermissionId).ToList(); _permissionService.AddPermissionsToRole(roleId, SelectedPermission); return(RedirectToAction("Index")); }