Untitled
unknown
plain_text
3 years ago
771 B
13
Indexable
public async Task<bool> DeleteAsync<TEntity>(int id) where TEntity : class, IEntity
{
try
{
var entity = await SingleAsync<TEntity>(e => e.Id.Equals(id));
if (entity is null) return false;
_db.Remove(entity);
}
catch { throw; }
return true;
}
public bool Delete<TReferenceEntity, TDto>(TDto dto) where TReferenceEntity : class where TDto : class
{
try
{
var entity = _mapper.Map<TReferenceEntity>(dto);
if (entity is null) return false;
_db.Remove(entity);
}
catch { throw; }
return true;
}Editor is loading...