public void Delete(TEntity entityToDelete) { if (_dbcontext.Entry(entityToDelete).State == EntityState.Detached) { dbset.Attach(entityToDelete); } dbset.Remove(entityToDelete); }
public void Update(TEntity entity) { dbSet.Attach(entity); context.Entry(entity).State = EntityState.Modified; context.SaveChanges(); }