public async Task <PagingQueryResult <OrganizationPagingQueryDTO> > Handle(OrganizationPagingQuery request, CancellationToken cancellationToken) { var result = new PagingQueryResult <OrganizationPagingQueryDTO>(); request.CheckPagingParam(); var specification = new OrganizationPagingSpecification(request.Page, request.PageSize, request.OrderBy, request.Desc, request.Search); result.Count = await organizationRepository.Get(specification).CountAsync(); var datas = await organizationRepository.Paging(specification).ToListAsync(); result.Items = mapper.Map <List <OrganizationPagingQueryDTO> >(datas); return(result); }
public async Task <PagingQueryResult <OrganizationPagingQueryDTO> > Handle(OrganizationPagingQuery request, CancellationToken cancellationToken) { var result = new PagingQueryResult <OrganizationPagingQueryDTO>(); request.CheckPagingParam(); var specification = new OrganizationPagingSpecification(identityService.GetOrganizationId(), request.Page, request.PageSize, request.OrderBy, request.Desc, request.Search); var dtos = await organizationRepository.Paging(specification).Select(x => OrganizationPagingQueryDTO.From(x)).ToListAsync(); //翻译组织类型名称 for (var idx = dtos.Count - 1; idx >= 0; idx--) { var it = dtos[idx]; var organType = Enumeration.FromValue <OrganizationType>(it.OrganizationTypeId); it.OrganizationTypeName = appLocalizer[organType.Name]; } result.Total = await organizationRepository.Get(specification).CountAsync(); result.Data = dtos; return(result); }