public ActionResult Create(GradeCreateSubmitModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            Grade grade = Mapper.Map <GradeCreateSubmitModel, Grade>(model);

            var redirectUrl = this.Session["redirectUrl"] as RedirectUrl;

            redirectUrl = redirectUrl ?? new RedirectUrl();

            var startYear = (int)redirectUrl.RedirectParameters["startYear"];

            AcademicYear academicYear =
                this.academicYearService.All().FirstOrDefault(ay => ay.StartDate.Year == startYear);

            academicYear = academicYear ?? new AcademicYear();

            grade.AcademicYearId = academicYear.Id;

            this.gradeService.Add(grade);

            return(RedirectToAction(
                       redirectUrl.RedirectActionName, redirectUrl.RedirectControllerName, redirectUrl.RedirectParameters));
        }
        public ActionResult Create()
        {
            var redirectUrl = this.Session["redirectUrl"] as RedirectUrl;

            redirectUrl = redirectUrl ?? new RedirectUrl();

            int startYear = (int)redirectUrl.RedirectParameters["startYear"];

            AcademicYear academicYear =
                this.academicYearService.All().FirstOrDefault(ay => ay.StartDate.Year == startYear);

            academicYear = academicYear ?? new AcademicYear();

            var model = new GradeCreateSubmitModel()
            {
                AcademicYearStartDate = academicYear.StartDate,
                AcademicYearEndDate   = academicYear.EndDate
            };

            return(View(model));
        }