コード例 #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));
            }
        }
コード例 #2
0
ファイル: ThemeController.cs プロジェクト: supermuk/iudico
        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);
            }
        }
コード例 #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));
            }
        }
コード例 #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));
            }
        }
コード例 #5
0
ファイル: ThemeController.cs プロジェクト: supermuk/iudico
        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);
            }
        }
コード例 #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));
            }
        }
コード例 #7
0
ファイル: ThemeController.cs プロジェクト: supermuk/iudico
        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);
            }
        }
コード例 #8
0
ファイル: ThemeController.cs プロジェクト: supermuk/iudico
        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);
            }
        }