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)); }
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)); }