コード例 #1
0
        public async Task <HopDto> GetSingleAsync(int id)
        {
            var hopDto = await _hopElasticsearch.GetSingleAsync(id);

            if (hopDto != null)
            {
                return(hopDto);
            }
            var hop = await _hopRepository.GetSingleAsync(id, "Flavours.Flavour", "Origin", "Substituts");

            hopDto = Mapper.Map <Hop, HopDto>(hop);
            return(hopDto);
        }
コード例 #2
0
        public async Task <HopDto> DeleteAsync(int id)
        {
            var hop = await _hopRepository.GetSingleAsync(id);

            var hopDto = await _hopElasticsearch.GetSingleAsync(id);

            if (hop != null)
            {
                await _hopRepository.RemoveAsync(hop);
            }
            if (hopDto != null)
            {
                await _hopElasticsearch.DeleteAsync(id);
            }
            await IndexBeerStylesAsync(hop);

            return(hopDto);
        }