Exemple #1
0
        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));
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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));
            }
        }
Exemple #4
0
        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));
            }
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        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));
            }
        }
Exemple #7
0
        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);
            }
        }
Exemple #8
0
        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);
            }
        }