Пример #1
0
 public virtual void Edit(TEntity entityToEdit)
 {
     if (Context.Entry(entityToEdit).State == EntityState.Detached)
     {
         DatabaseSet.Attach(entityToEdit);
     }
     Context.Entry(entityToEdit).State = EntityState.Modified;
 }
Пример #2
0
        public virtual void Delete(TEntity entityToDelete)
        {
            if (Context.Entry(entityToDelete).State == EntityState.Detached)
            {
                DatabaseSet.Attach(entityToDelete);
            }

            DatabaseSet.Remove(entityToDelete);
        }