Example #1
0
        public async Task RemoveAsync_Gets_Deleted()
        {
            var delete = _beerStyleRepository.GetAll().LastOrDefault();
            await _beerStyleRepository.RemoveAsync(delete);

            var beerStyle = _beerStyleRepository.GetSingle(delete.BeerStyleId);

            Assert.Null(beerStyle);
        }
        public async Task <BeerStyleDto> DeleteAsync(int id)
        {
            var beerStyle = await _beerStyleRepository.GetSingleAsync(id);

            var beerStyleDto = await _beerStyleElasticsearch.GetSingleAsync(id);

            if (beerStyle != null)
            {
                await _beerStyleRepository.RemoveAsync(beerStyle);
            }
            if (beerStyleDto != null)
            {
                await _beerStyleElasticsearch.DeleteAsync(id);
            }
            return(beerStyleDto);
        }
Example #3
0
        public async Task <BeerStyleDto> DeleteAsync(int id)
        {
            var beerStyle = await _beerStyleRepository.GetSingleAsync(id);

            var beerStyleDto = await _beerStyleElasticsearch.GetSingleAsync(id);

            if (beerStyle != null)
            {
                await _beerStyleRepository.RemoveAsync(beerStyle);
            }
            if (beerStyleDto != null)
            {
                await _beerStyleElasticsearch.DeleteAsync(id);
            }
            await IndexHopAsync(beerStyle);

            return(beerStyleDto ?? AutoMapper.Mapper.Map <BeerStyle, BeerStyleDto>(beerStyle));
        }