public void RemoveMedical(int id) { LoadMedicalsFromDatabase(); Medical med = new Medical(); foreach (Medical m in medicalList) { if (m.Id == id) med = m; } using (ISession session = NhibernateService.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.Delete(med); transaction.Commit(); } } LoadMedicalsFromDatabase(); Notify(); }
public void AddMedical(string description, DateTime date, Prisoner pris) { LoadMedicalsFromDatabase(); Medical med = new Medical(description, date, pris); using (ISession session = NhibernateService.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.Save(med); transaction.Commit(); } } LoadMedicalsFromDatabase(); Notify(); }