public async Task <ServiceResponse <TEntity> > Delete(Guid entityId) { try { var entityResouce = await _baseEntityRepository.GetById(entityId); if (entityResouce == null) { return(new ServiceResponse <TEntity>($"The Resource Could not be Found")); } else { await _baseEntityRepository.Delete(entityId); return(new ServiceResponse <TEntity>(entityResouce)); } } catch (Exception ex) { return(new ServiceResponse <TEntity>($"An Error Occured While deleting the Resource. {ex.Message}")); } }
public virtual int Delete(int id) { var entity = Mapper.Map <TDEntity, TSEntity>(Get(id)); return(_repository.Delete(entity)); }