public RoleListModel Get(RoleListModelFilter filter) { var collection = _roleRepository.GetRolesByName(filter.Name); var viewModels = collection.Select(r => new RoleViewModel { Id = r.Id, Name = r.DisplayName, ParentId = r.ParentId ?? 0, ParentRole = r.ParentId != null && r.ParentId.Value > 0 ? collection.FirstOrDefault(x => x.Id == r.ParentId.Value).DisplayName : string.Empty, ShortName = r.Alias, UserCount = _roleRepository.GetRoleCount(r.Id) }).ToArray(); return(new RoleListModel { Filter = filter, Collection = viewModels }); }
public virtual ActionResult List(RoleListModelFilter filter = null) { filter = filter ?? new RoleListModelFilter(); return(View("List", _roleService.Get(filter))); }