public virtual void Edit(TEntity entityToEdit) { if (Context.Entry(entityToEdit).State == EntityState.Detached) { DatabaseSet.Attach(entityToEdit); } Context.Entry(entityToEdit).State = EntityState.Modified; }
public virtual void Delete(TEntity entityToDelete) { if (Context.Entry(entityToDelete).State == EntityState.Detached) { DatabaseSet.Attach(entityToDelete); } DatabaseSet.Remove(entityToDelete); }