Beispiel #1
0
        public async Task <BeerStyleDto> GetSingleAsync(int id)
        {
            var beerStyleDto = await _beerStyleElasticsearch.GetSingleAsync(id);

            if (beerStyleDto != null)
            {
                return(beerStyleDto);
            }
            var beerStyle = await _beerStyleRepository.GetSingleAsync(id);

            return(AutoMapper.Mapper.Map <BeerStyle, BeerStyleDto>(beerStyle));
        }
Beispiel #2
0
        private async Task IndexBeerStylesAsync(Hop hop)
        {
            foreach (var hopBeerStyle in hop.HopBeerStyles)
            {
                var beerStyle = await _beerStyleRepository.GetSingleAsync(hopBeerStyle.BeerStyleId);

                await _beerStyleElasticsearch.UpdateAsync(AutoMapper.Mapper.Map <BeerStyle, BeerStyleDto>(beerStyle));
            }
        }
Beispiel #3
0
        public async Task GetSingleAsync_Returns_Single_BeerStyle()
        {
            var beerStyle = await _beerStyleRepository.GetSingleAsync(2);

            Assert.NotNull(beerStyle);
        }