Exemplo n.º 1
0
        public async Task GetSingleAsync_Not_Null_Not_Empty()
        {
            var yeast = await _yeastRepository.GetSingleAsync(1);

            Assert.NotNull(yeast);
            Assert.True(yeast.Name.Any());
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        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);
        }