public async Task <PagingQueryResult <PackageMapPagingQueryDTO> > Handle(PackageMapPagingQuery request, CancellationToken cancellationToken) { var result = new PagingQueryResult <PackageMapPagingQueryDTO>(); request.CheckPagingParam(); var specification = new PackageMapPagingSpecification(request.Page, request.PageSize, request.Search, request.OrderBy, request.Desc); var datas = await packageMapRepository.Paging(specification).Select(x => new { x.Id, x.Package, x.ResourceId, x.ResourceType }).ToListAsync(); result.Total = await packageMapRepository.Get(specification).CountAsync(); result.Data = datas.Select(x => PackageMapPagingQueryDTO.From(x.Id, x.Package, x.ResourceId, x.ResourceType)).ToList(); return(result); }
public async Task <IActionResult> Get([FromQuery] PackageMapPagingQuery query) { var list = await _mediator.Send(query); return(Ok(list)); }