public ActionResult Edit(int themeId) { try { Theme theme = Storage.GetTheme(themeId); if (theme != null) { ThemeModel model = new ThemeModel() { StageId = theme.StageRef, ThemeId = themeId, Courses = from course in Storage.GetCourses() select new SelectListItem { Text = course.Name, Value = course.Id.ToString(), Selected = false } }; return(View(model)); } else { throw new Exception("Theme doesn't exist!"); } } catch (Exception e) { return(ErrorView(e)); } }
public ActionResult Create(ThemeModel model) { try { Theme theme = new Theme() { CourseRef = model.CourseId, StageRef = model.StageId }; Storage.AddTheme(theme); return RedirectToAction("Index", new { StageId = model.StageId }); } catch (Exception e) { return ErrorView(e); } }
public ActionResult Edit(ThemeModel model) { try { Theme theme = Storage.GetTheme(model.ThemeId); theme.CourseRef = model.CourseId; Storage.UpdateTheme(theme); return(RedirectToRoute("Themes", new { action = "Index", StageId = theme.StageRef })); } catch (Exception e) { return(ErrorView(e)); } }
public ActionResult Create(ThemeModel model) { try { Theme theme = new Theme() { CourseRef = model.CourseId, StageRef = model.StageId }; Storage.AddTheme(theme); return(RedirectToAction("Index", new { StageId = model.StageId })); } catch (Exception e) { return(ErrorView(e)); } }
public ActionResult Create(int stageId) { try { ThemeModel model = new ThemeModel() { StageId = stageId, Courses = from course in Storage.GetCourses() select new SelectListItem { Text = course.Name, Value = course.Id.ToString(), Selected = false } }; return View(model); } catch (Exception e) { return ErrorView(e); } }
public ActionResult Create(int stageId) { try { ThemeModel model = new ThemeModel() { StageId = stageId, Courses = from course in Storage.GetCourses() select new SelectListItem { Text = course.Name, Value = course.Id.ToString(), Selected = false } }; return(View(model)); } catch (Exception e) { return(ErrorView(e)); } }
public ActionResult Edit(int themeId) { try { Theme theme = Storage.GetTheme(themeId); if (theme != null) { ThemeModel model = new ThemeModel() { StageId = theme.StageRef, ThemeId = themeId, Courses = from course in Storage.GetCourses() select new SelectListItem { Text = course.Name, Value = course.Id.ToString(), Selected = false } }; return View(model); } else { throw new Exception("Theme doesn't exist!"); } } catch (Exception e) { return ErrorView(e); } }
public ActionResult Edit(ThemeModel model) { try { Theme theme = Storage.GetTheme(model.ThemeId); theme.CourseRef = model.CourseId; Storage.UpdateTheme(theme); return RedirectToRoute("Themes", new { action = "Index", StageId = theme.StageRef }); } catch (Exception e) { return ErrorView(e); } }