Beispiel #1
0
        public virtual async Task <TDto> DeleteAsync(TID id, Action <string, string> AddErrorMessage)
        {
            if (!await _repository.AnyAsync(e => e.Equals(id)))
            {
                throw new EntityNotFoundException <TEntity, TID>(id);
            }

            TEntity deletedEntity = await _repository.DeleteAsync(id);

            if (deletedEntity != null)
            {
                await _context.SaveChangesAsync();
            }

            return(_mappingService.EntityToDto(deletedEntity));
        }