public async Task <PagingQueryResult <RolePagingQueryDTO> > Handle(RolePagingQuery request, CancellationToken cancellationToken)
        {
            request.CheckPagingParam();
            var result = new PagingQueryResult <RolePagingQueryDTO>();
            var roles  = Enumeration.GetAll <SystemRole>();

            result.Total = roles.Count();
            result.Data  = roles.Skip((request.Page - 1) * request.PageSize).Take(request.PageSize).Select(x =>
            {
                var dto             = new RolePagingQueryDTO();
                dto.Id              = x.Id;
                dto.Name            = appLocalizer[x.Name];
                dto.Description     = appLocalizer[x.Description];
                dto.AccessPointKeys = x.AccessPointKeys;
                return(dto);
            }).ToList();
            return(await Task.FromResult(result));
        }
예제 #2
0
        public async Task <IActionResult> Get([FromQuery] RolePagingQuery query)
        {
            var list = await _mediator.Send(query);

            return(Ok(list));
        }