public async Task <IActionResult> ManageRoles(string authorizedAction = null, int?roleId = null) { var list = await _cachedSecurityService.ListAllSecurityRoleDetails(); var model = new ManageRolesViewModel() { AllRoles = _mapper.Map <List <SecurityRoleDetail>, List <SecurityRoleViewModel> >(list.ToList()) }; model.Roles = model.AllRoles.Where(x => (String.IsNullOrEmpty(authorizedAction) || x.IsAuthorized(authorizedAction)) && (roleId == null || x.Id == roleId.Value)).ToList(); return(View(model)); }
async Task <SecurityUserRoleViewModel> ICachedSecurityService.GetSecurityRoleDetails(int id) { var roles = await _this.ListAllSecurityRoleDetails(); var roleDetails = roles.Single(x => x.Id == id); return(_mapper.Map <SecurityRoleDetail, SecurityUserRoleViewModel>(roleDetails));; }