public TEntity Remove(TEntity entity) { var dbSet = _context.Set <TEntity>(); if (_context.Entry(entity).State == EntityState.Detached) { dbSet.Attach(entity); } return(dbSet.Remove(entity)); }
public virtual TEntity Remove <TEntity>(TEntity entity) where TEntity : class, new() { var dbSet = _context.Set <TEntity>(); if (_context.Entry(entity).State == EntityState.Detached) { dbSet.Attach(entity); } return(dbSet.Remove(entity)); }