public ActionResult Create(Report report) { if (ModelState.IsValid) { DB.Reports.Add(report); DB.SaveChanges(); return this.RedirectToLoginIfNotAuthenticated(RedirectToAction("Index")); } return this.RedirectToLoginIfNotAuthenticated(View(report)); }
public ActionResult Edit(Report report) { if (ModelState.IsValid) { foreach (var testGroup in report.TestGroups) { foreach (var test in testGroup.Tests) { foreach (var question in test.Questions) { DB.Entry(question).State = EntityState.Modified; } DB.Entry(test).State = EntityState.Modified; } DB.Entry(testGroup).State = EntityState.Modified; } DB.Entry(report).State = EntityState.Modified; DB.SaveChanges(); return this.RedirectToLoginIfNotAuthenticated(RedirectToAction("Index")); } return this.RedirectToLoginIfNotAuthenticated(View(report)); }