예제 #1
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));
        }
예제 #2
0
        public async Task <GlassDto> DeleteAsync(int id)
        {
            var glass = await _glassRepository.GetSingleAsync(id);

            var glassDto = await _glassElasticsearch.GetSingleAsync(id);

            if (glass != null)
            {
                await _glassRepository.RemoveAsync(glass);
            }
            if (glassDto != null)
            {
                await _glassElasticsearch.DeleteAsync(id);
            }
            return(glassDto ?? AutoMapper.Mapper.Map <Glass, GlassDto>(glass));
        }