Ejemplo n.º 1
0
        public ActionResult Edit(int timelineId, CreateChapterTimelineModel editChapterTimelineModel)
        {
            try
            {
                Timeline timeline = editChapterTimelineModel.Timeline;

                timeline.CurriculumRef = Storage.GetTimeline(timelineId).CurriculumRef;
                timeline.ChapterRef = editChapterTimelineModel.ChapterId;
                timeline.Id = timelineId;

                AddValidationErrorsToModelState(Validator.ValidateChapterTimeline(timeline).Errors);

                if (ModelState.IsValid)
                {
                    Storage.UpdateTimeline(timeline);

                    return RedirectToRoute("ChapterTimelines", new { action = "Index", CurriculumId = Session["CurriculumId"] });
                }
                else
                {
                    SaveValidationErrors();

                    return RedirectToAction("Edit");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int timelineId)
        {
            try
            {
                LoadValidationErrors();

                Timeline timeline = Storage.GetTimeline(timelineId);
                Curriculum curriculum = Storage.GetCurriculum(timeline.CurriculumRef);
                Discipline discipline = Storage.GetDiscipline(curriculum.DisciplineRef);
                Group group = Storage.GetGroup(curriculum.UserGroupRef);
                CreateChapterTimelineModel editChapterTimelineModel = new CreateChapterTimelineModel(timeline,
                    Storage.GetChapters(Storage.GetCurriculum(timeline.CurriculumRef).DisciplineRef), (int)timeline.ChapterRef);

                Session["CurriculumId"] = timeline.CurriculumRef;
                ViewData["GroupName"] = group.Name;
                ViewData["DisciplineName"] = discipline.Name;
                return View(editChapterTimelineModel);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 3
0
        public ActionResult Create(int curriculumId, CreateChapterTimelineModel createTimelineModel)
        {
            try
            {
                Timeline timeline = createTimelineModel.Timeline;
                timeline.CurriculumRef = curriculumId;
                timeline.ChapterRef = createTimelineModel.ChapterId;

                AddValidationErrorsToModelState(Validator.ValidateChapterTimeline(timeline).Errors);

                if (ModelState.IsValid)
                {
                    Storage.AddTimeline(timeline);

                    return RedirectToAction("Index", new { CurriculumId = curriculumId });
                }
                else
                {
                    SaveValidationErrors();

                    return RedirectToAction("Create");
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 4
0
        public ActionResult Create(int curriculumId)
        {
            try
            {
                LoadValidationErrors();

                Curriculum curriculum = Storage.GetCurriculum(curriculumId);
                Discipline discipline = Storage.GetDiscipline(curriculum.DisciplineRef);
                Group group = Storage.GetGroup(curriculum.UserGroupRef);
                CreateChapterTimelineModel createTimelineModel = new CreateChapterTimelineModel(new Timeline(),
                    Storage.GetChapters(curriculum.DisciplineRef), 0);

                ViewData["GroupName"] = group.Name;
                ViewData["DisciplineName"] = discipline.Name;
                return View(createTimelineModel);
            }
            catch (Exception e)
            {
                throw e;
            }
        }