Пример #1
0
        private void ChangeState(T entity, EntityState state)
        {
            var entry = context.Entry(entity);

            if (entry.State == EntityState.Detached)
            {
                entitySet.Attach(entity);
            }

            entry.State = state;
        }
Пример #2
0
 public void Update(T obj)
 {
     _table.Attach(obj);
     _db.Entry(obj).State = EntityState.Modified;
 }