public void UpdateFall(Fall fall) { var ToUpdate = GetFall(fall.id); if (ToUpdate == null) { throw new Exception("the assessment to update not found"); } using (var db = new Project_Db_Context()) { db.Entry(fall); db.Falls.AddOrUpdate(fall); db.SaveChanges(); } }
public void UpdateReport(Report report) { var ToUpdate = GetReport(report.id); if (ToUpdate == null) { throw new Exception("the report to update not found"); } using (var db = new Project_Db_Context()) { db.Entry(report); db.Reports.AddOrUpdate(report); db.SaveChanges(); } }
public void UpdateAssessment(Assessment assessment) { var ToUpdate = GetAssessment(assessment.id); if (ToUpdate == null) { throw new Exception("the assessment to update not found"); } using (var db = new Project_Db_Context()) { foreach (Location_ l in assessment.Locations) { db.Locations.Add(l); db.SaveChanges(); } db.Entry(assessment); db.Assessments.AddOrUpdate(assessment); db.SaveChanges(); } }