public void RemoveEvaluation(int id) { LoadEvaluationsFromDatabase(); Evaluation eval = new Evaluation(); foreach (Evaluation e in evaluationList) { if (e.Id == id) eval = e; } using (ISession session = NhibernateService.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.Delete(eval); transaction.Commit(); } } LoadEvaluationsFromDatabase(); Notify(); }
public void AddEvaluation(DateTime date, string description, Prisoner pris) { LoadEvaluationsFromDatabase(); Evaluation eval = new Evaluation(description, date, pris); using (ISession session = NhibernateService.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.Save(eval); transaction.Commit(); } } LoadEvaluationsFromDatabase(); Notify(); }