public void CancellaStudente(int id) { var studente = db.Studenti.Find(id); if (studente != null) { db.Entry(studente).State = Microsoft.EntityFrameworkCore.EntityState.Deleted; db.SaveChanges(); } }
public void CreaStudente(Studente studente) { db.Studenti.Add(studente); db.SaveChanges(); }