public void Delete(TEntity entityToDelete) { dbSet = context.Set <TEntity>(); if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); context.Entry(entityToDelete).State = EntityState.Deleted; context.SaveChanges(); }
public GenericRepository(GestionEstadioContext context) { this.context = context; dbSet = context.Set <TEntity>(); }