public ActionResult Create(int curriculumAssignmentId, CreateCurriculumAssignmentTimelineModel createTimelineModel)
        {
            try
            {
                Timeline timeline = createTimelineModel.Timeline;
                timeline.CurriculumAssignmentRef = curriculumAssignmentId;
                timeline.StageRef = null;

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

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

                    return(RedirectToAction("Index", new { CurriculumAssignmentId = curriculumAssignmentId }));
                }
                else
                {
                    SaveValidationErrors();

                    return(RedirectToAction("Create"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public ActionResult Edit(int timelineId, CreateCurriculumAssignmentTimelineModel editTimelineModel)
        {
            try
            {
                Timeline timeline = editTimelineModel.Timeline;
                timeline.Id = timelineId;

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

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

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

                    return(RedirectToAction("Edit"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public ActionResult Create(int curriculumAssignmentId)
        {
            try
            {
                LoadValidationErrors();

                CurriculumAssignment curriculumAssignment = Storage.GetCurriculumAssignment(curriculumAssignmentId);
                Curriculum           curriculum           = Storage.GetCurriculum(curriculumAssignment.CurriculumRef);
                Group group = Storage.GetGroup(curriculumAssignment.UserGroupRef);
                CreateCurriculumAssignmentTimelineModel createTimelineModel = new CreateCurriculumAssignmentTimelineModel(new Timeline());

                ViewData["GroupName"]      = group.Name;
                ViewData["CurriculumName"] = curriculum.Name;
                return(View(createTimelineModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public ActionResult Edit(int timelineId)
        {
            try
            {
                LoadValidationErrors();

                Timeline             timeline             = Storage.GetTimeline(timelineId);
                CurriculumAssignment curriculumAssignment = Storage.GetCurriculumAssignment(timeline.CurriculumAssignmentRef);
                Curriculum           curriculum           = Storage.GetCurriculum(curriculumAssignment.CurriculumRef);
                Group group = Storage.GetGroup(curriculumAssignment.UserGroupRef);
                CreateCurriculumAssignmentTimelineModel editTimelineModel = new CreateCurriculumAssignmentTimelineModel(timeline);

                ViewData["GroupName"]             = group.Name;
                ViewData["CurriculumName"]        = curriculum.Name;
                Session["CurriculumAssignmentId"] = timeline.CurriculumAssignmentRef;
                return(View(editTimelineModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }