예제 #1
0
        public Result List(AdminRoleFilterDto dto)
        {
            var result =
                new AdminRoleActionFactory(_adminRoleRepository, _unitOfWork).ExecuteAction(dto);

            if (!result.Success)
            {
                return(result);
            }

            var query = _adminRoleRepository.AsNoTracking;

            query = new AdminRoleFilter(query, dto).FilteredQuery();
            query = new AdminRoleListOrder(query, dto).OrderByQuery();
            result.SetPaging(dto.Page, dto.Size, query.Count());

            result.Data = query.Select(s => new
            {
                s.Id,
                s.Name,
                UsersCount = s.Users.Count
            })
                          .ToPaged(result.Paging.Page, result.Paging.Size)
                          .ToList();

            return(result);
        }
예제 #2
0
 public JsonResult Index(AdminRoleFilterDto dto)
 {
     return(ToJsonResult(_adminRoleService.List(dto)));
 }