/// <summary> /// List of roles to apply permissions to /// </summary> /// <returns></returns> public ActionResult Index() { var permViewModel = new ChoosePermissionsViewModel { MembershipRoles = _roleService.AllRoles().ToList(), Permissions = _permissionService.GetAll().ToList() }; return(View(permViewModel)); }
public ActionResult Index() { var currentSettings = SettingsService.GetSettings(); var settingViewModel = ViewModelMapping.SettingsToSettingsViewModel(currentSettings); settingViewModel.NewMemberStartingRole = _roleService.GetRole(currentSettings.NewMemberStartingRole.Id).Id; settingViewModel.DefaultLanguage = LocalizationService.DefaultLanguage.Id; settingViewModel.Roles = _roleService.AllRoles().ToList(); settingViewModel.Languages = LocalizationService.AllLanguages.ToList(); return(View(settingViewModel)); }
public virtual ActionResult ManageUser(Guid groupUserId) { // Get the Group var groupUser = _groupService.GetGroupUser(groupUserId); var roles = _roleService.AllRoles().Where(x => x.RoleName != Constants.GuestRoleName); var selectList = new List <SelectListItem>(roles.Select(x => new SelectListItem { Text = x.RoleName, Value = x.Id.ToString() })); var viewModel = new GroupUserViewModel { GroupUser = groupUser, GroupUserStatus = groupUser.GetUserStatusForGroup(), RoleSelectList = selectList, MemberRole = GetGroupMembershipRole(groupUser.Group.Id) }; return(View(viewModel)); }
private async Task <ActionResult> ListUsers(int?p, string search) { var pageIndex = p ?? 1; var allUsers = string.IsNullOrWhiteSpace(search) ? await MembershipService.GetAll(pageIndex, SiteConstants.Instance.AdminListPageSize) : await MembershipService.SearchMembers(search, pageIndex, SiteConstants.Instance.AdminListPageSize); // Redisplay list of users var allViewModelUsers = allUsers.Select(ViewModelMapping.UserToSingleMemberListViewModel).ToList(); var memberListModel = new MemberListViewModel { Users = allViewModelUsers, AllRoles = _roleService.AllRoles(), Id = MembershipService.GetUser(User.Identity.Name).Id, PageIndex = pageIndex, TotalCount = allUsers.TotalCount, Search = search, TotalPages = allUsers.TotalPages }; return(View("List", memberListModel)); }
private ActionResult ListUsers(int?p, string search) { using (UnitOfWorkManager.NewUnitOfWork()) { var pageIndex = p ?? 1; var allUsers = string.IsNullOrEmpty(search) ? MembershipService.GetAll(pageIndex, SiteConstants.AdminListPageSize) : MembershipService.SearchMembers(search, pageIndex, SiteConstants.AdminListPageSize); // Redisplay list of users var allViewModelUsers = allUsers.Select(ViewModelMapping.UserToSingleMemberListViewModel).ToList(); var memberListModel = new MemberListViewModel { Users = allViewModelUsers, AllRoles = _roleService.AllRoles(), Id = MembershipService.GetUser(User.Identity.Name).Id, PageIndex = pageIndex, TotalCount = allUsers.TotalCount, Search = search }; return(View("List", memberListModel)); } }