public void Delete(T entityToDelete) { if (Context.Entry(entityToDelete).State == EntityState.Detached) { _dbSet.Attach(entityToDelete); } _dbSet.Remove(entityToDelete); }
public virtual void Update(T entity) { _dbset.Attach(entity); _dataContext.Entry(entity).State = EntityState.Modified; }