public ActionResult MyTime(string code) { StudentMyTimeModel m = new StudentMyTimeModel(code); return View(m); }
public ActionResult SubmitMyTime(string Code, string timeID) { StudentMyTimeModel m = new StudentMyTimeModel(Code); try { if (ModelState.IsValid) { StudentTime st = new StudentTime(); st.studentID = new Student(Code, Musical.CurrentMusical().musicalID).studentID; st.timeID = Int32.Parse(timeID); if (!st.IsAvailable()) throw new Exception("Too slow! This time has filled up. Please select another time."); st.Save(); return RedirectToRoute("StudentConfirmation", new { Code = Code }); } else { return View("MyTime", m); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View("MyTime", m); } }