public JsonResult ListRoles(String RoleName) { String[] roles = Roles.GetAllRoles(); AuthenticationsAndAuthorizationsOperations authenNAuthorOps = new AuthenticationsAndAuthorizationsOperations(); List <RoleViewModel> listRoles = new List <RoleViewModel>(); foreach (String role in roles) { listRoles.Add(new RoleViewModel { NewRoleName = role, OldRoleName = role, Description = authenNAuthorOps.GetRoleDescByRoleName(role) }); } return(Json(new { Total = listRoles.Count, Data = listRoles })); }
public ActionResult EditRole(String roleName) { String[] roles = Roles.GetAllRoles(); RoleViewModel roleViewModel = new RoleViewModel(); AuthenticationsAndAuthorizationsOperations anaOps = new AuthenticationsAndAuthorizationsOperations(); foreach (String role in roles) { if (role == roleName) { roleViewModel.OldRoleName = role; roleViewModel.NewRoleName = role; roleViewModel.Description = anaOps.GetRoleDescByRoleName(roleName); } } return(View(roleViewModel)); }