Пример #1
0
        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());
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
 public Task <ListDto <PresidentDto, string> > GetAllPresidents(GetAllPresidentsDto request)
 => _readRepository.GetAllPresidents(request);