Пример #1
0
        public async Task AddAsync_Gets_Added()
        {
            var newYeast = new Yeast {
                Name = "newYeast" + DateTime.Now.Ticks, ProductCode = "AAA", Type = "Liquid", Custom = true
            };
            await _yeastRepository.AddAsync(newYeast);

            var yeasts = await _yeastRepository.GetAllAsync();

            Assert.True(yeasts.Any(o => o.Name == newYeast.Name));
        }
Пример #2
0
        public async Task <YeastDto> AddAsync(YeastDto yeastDto)
        {
            var yeast = Mapper.Map <YeastDto, Yeast>(yeastDto);
            await _yeastRepository.AddAsync(yeast);

            var result = await _yeastRepository.GetSingleAsync(yeast.YeastId, "Supplier");

            var mappedResult = Mapper.Map <Yeast, YeastDto>(result);
            await _yeastElasticsearch.UpdateAsync(mappedResult);

            return(mappedResult);
        }
Пример #3
0
        public async Task <YeastDto> AddAsync(YeastDto yeastDto)
        {
            var yeast = AutoMapper.Mapper.Map <YeastDto, Yeast>(yeastDto);
            await _yeastRepository.AddAsync(yeast);

            _logger.LogInformation($"YeastId: {yeast.YeastId}");
            var result = await _yeastRepository.GetSingleAsync(yeast.YeastId);

            var mappedResult = AutoMapper.Mapper.Map <Yeast, YeastDto>(result);
            await _yeastElasticsearch.UpdateAsync(mappedResult);

            return(mappedResult);
        }