public async Task GetSingleAsync_Not_Null_Not_Empty()
        {
            var glass = await _glassRepository.GetSingleAsync(1);

            Assert.NotNull(glass);
            Assert.True(glass.Name.Any());
        }
        public async Task <GlassDto> AddAsync(GlassDto glassDto)
        {
            var glass = AutoMapper.Mapper.Map <GlassDto, Glass>(glassDto);
            await _glassRepository.AddAsync(glass);

            var result = await _glassRepository.GetSingleAsync(glass.GlassId);

            var mappedResult = AutoMapper.Mapper.Map <Glass, GlassDto>(result);
            await _glassElasticsearch.UpdateAsync(mappedResult);

            return(mappedResult);
        }
示例#3
0
        public async Task <GlassDto> GetSingleAsync(int id)
        {
            var glassDto = await _glassElasticsearch.GetSingleAsync(id);

            if (glassDto != null)
            {
                return(glassDto);
            }
            var glass = await _glassRepository.GetSingleAsync(id);

            return(Mapper.Map <Glass, GlassDto>(glass));
        }