public async Task <IEnumerable <HopDto> > GetAllAsync(int from, int size) { var hopsDto = await _hopElasticsearch.GetAllAsync(from, size); if (hopsDto.Any()) { return(hopsDto); } var hops = await _hopRepository.GetAllAsync(from, size); hopsDto = AutoMapper.Mapper.Map <IEnumerable <Hop>, IList <HopDto> >(hops); return(hopsDto); }
public async Task <IEnumerable <HopDto> > GetHopsAsync(string custom) { var hopsDto = await _hopElasticsearch.GetAllAsync(custom); if (hopsDto.Any()) { return(hopsDto); } var hops = await _hopRepository.GetAllAsync("Flavours.Flavour", "Origin", "Substituts"); hopsDto = Mapper.Map <IList <Hop>, IList <HopDto> >(hops); return(hopsDto); }