public async Task <YeastDto> GetSingleAsync(int id)
        {
            var yeastDto = await _yeastElasticsearch.GetSingleAsync(id);

            if (yeastDto != null)
            {
                return(yeastDto);
            }
            var yeast = await _yeastRepository.GetSingleAsync(id, "Supplier");

            yeastDto = Mapper.Map <Yeast, YeastDto>(yeast);
            return(yeastDto);
        }
Beispiel #2
0
        public async Task <YeastDto> DeleteAsync(int id)
        {
            var yeast = await _yeastRepository.GetSingleAsync(id);

            var yeastDto = await _yeastElasticsearch.GetSingleAsync(id);

            if (yeast != null)
            {
                await _yeastRepository.RemoveAsync(yeast);
            }
            if (yeastDto != null)
            {
                await _yeastElasticsearch.DeleteAsync(id);
            }
            return(yeastDto ?? AutoMapper.Mapper.Map <Yeast, YeastDto>(yeast));
        }