示例#1
0
        public async Task <IEnumerable <BreweryDto> > GetAllAsync(int from, int size)
        {
            var brewerysDto = await _breweryElasticsearch.GetAllAsync(from, size);

            //if (brewerysDto .Any()) return brewerysDto ;
            var brewerys = await _breweryRepository.GetAllAsync(from, size, "Members.Member", "Beers", "Socials", "Origin", "Beers.Beer.IBU", "Beers.Beer.ABV", "Beers.Beer.SRM", "Beers.Beer.BeerStyle");

            brewerysDto = Mapper.Map <IEnumerable <Brewery>, IEnumerable <BreweryDto> >(brewerys);
            return(brewerysDto);
        }
        public async Task <IEnumerable <BreweryDto> > GetAllAsync(int @from, int size, bool?isCommerical, string origin, bool?hasBeers)
        {
            var brewerysDto = await _breweryElasticsearch.GetAllAsync(from, size, isCommerical, origin, hasBeers);

            if (brewerysDto.Any())
            {
                return(brewerysDto);
            }
            var brewerys = await _breweryRepository.GetAllAsync(from, size, isCommerical, origin, hasBeers);

            return(AutoMapper.Mapper.Map <IEnumerable <Brewery>, IEnumerable <BreweryDto> >(brewerys));
        }