public virtual void Delete(TEntity entity) { if (_db.Entry(entity).State == EntityState.Detached) { _dbset.Attach(entity); } _dbset.Remove(entity); }
public bool DeleteCustomer(CustomerTB customer) { try { _db.Entry(customer).State = EntityState.Deleted; return(true); } catch { return(false); } }