private void ChangeState(T entity, EntityState state) { var entry = context.Entry(entity); if (entry.State == EntityState.Detached) { entitySet.Attach(entity); } entry.State = state; }
public void Update(T obj) { _table.Attach(obj); _db.Entry(obj).State = EntityState.Modified; }