public virtual ActionResult Create(TasterSession tasterSession) { if(ModelState.IsValid) { tasterSession.Centre = MvcApplication.CurrentSession.Load<Centre>(tasterSession.CentreId); tasterSession.Tutor = MvcApplication.CurrentSession.Load<Person>(tasterSession.TutorId); MvcApplication.CurrentSession.Store(tasterSession); return RedirectToAction(MVC.TasterSession.Actions.Index()); } else { return View(MVC.TasterSession.Views.Edit, tasterSession); } }
public virtual ActionResult Edit(TasterSession tasterSession) { if(ModelState.IsValid) { tasterSession.Centre = MvcApplication.CurrentSession.Load<Centre>(tasterSession.CentreId); tasterSession.Tutor = MvcApplication.CurrentSession.Load<Person>(tasterSession.TutorId); MvcApplication.CurrentSession.Store(tasterSession); TempData.SetMessage("Taster session updated"); return RedirectToAction(MVC.TasterSession.Actions.Index()); } else { return View(tasterSession); } }