public async Task <IActionResult> Get([FromQuery] GetAllPresidentsDto requestDto) { var response = await _whiteHouseAppService.GetAllPresidents(requestDto); return(CreateResponse <PresidentDto, string>() .FromErrorEnum(PresidentDto.Error.GetAllPresident) .WithMessage(AppConsts.LocalizationSourceName, PresidentDto.Error.GetAllPresident) .WithDto(response) .Build()); }
public async Task <ListDto <PresidentDto, string> > GetAllPresidents(GetAllPresidentsDto request) { var query = Client.Query <PresidentPoco>().ProcessFilter() .SkipAndTakeByRequestDto(request) .OrderByRequestDto(request) .IndexType(Provider.Carol.Messages.ProcessFilter.IndexType.STAGING) .MustList((m) => m.TypeFilter() .MatchFilter(p => p.Name, request.Name) .TermFilter(p => p.Address.ZipCode.Number, request.ZipCode)); var resultData = await GetAllAsync(query); return(resultData.ToListDto <PresidentPoco, PresidentDto, string>(request)); }
public Task <ListDto <PresidentDto, string> > GetAllPresidents(GetAllPresidentsDto request) { var presidents = _presidents .Select(s => s.Value) .AsQueryable() .SkipAndTakeByRequestDto(request) .OrderByRequestDto(request) .ToList(); var result = new ListDto <PresidentDto, string> { Items = presidents.MapTo <List <PresidentDto> >() }; return(Task.FromResult(result)); }
public Task <ListDto <PresidentDto, string> > GetAllPresidents(GetAllPresidentsDto request) => _readRepository.GetAllPresidents(request);