public ActionResult Add(AcademicYearRegisterModel academicYearModel)
        {
            var year     = new DateTime(academicYearModel.Year, 01, 01);
            var approved = false;
            var isActive = false;

            if (academicYearModel.Approved == "1")
            {
                approved = true;
            }
            if (academicYearModel.IsActive == "1")
            {
                isActive = true;
            }
            var academicYear = new AcademicYear
            {
                Year     = year.Year,
                Grade    = _gradeRepository.GetById(academicYearModel.Grade.Id),
                Section  = academicYearModel.Section,
                Approved = approved,
                IsActive = isActive
            };

            _academicYearRepository.Create(academicYear);
            const string title   = "Año Académico Agregado";
            var          content = "El año académico " + academicYearModel.Year + " ha sido agregado exitosamente.";

            _viewMessageLogic.SetNewMessage(title, content, ViewMessageType.SuccessMessage);
            return(RedirectToAction("Index"));
        }
        public ActionResult Add(AcademicYearRegisterModel academicYearModel)
        {
            if (_academicYearRepository.Filter(x => x.Year == academicYearModel.Year).Any())
            {
                _viewMessageLogic.SetNewMessage("Error", "Este año académico ya existe.", ViewMessageType.ErrorMessage);
                return(RedirectToAction("Index"));
            }
            var toCreate = Mapper.Map <AcademicYear>(academicYearModel);

            toCreate = _academicYearRepository.Create(toCreate);
            const string title   = "Año Académico Agregado";
            bool         v       = _gradeRepository.GetAllGrade().Any();
            var          content = v ? "Elija la cantidad de secciones a crearse y el pensum a usarse para cada grado."
                : "El año académico " + toCreate.Year + " ha sido agregado exitosamente.";

            _viewMessageLogic.SetNewMessage(title, content, ViewMessageType.SuccessMessage);
            return(v ? RedirectToAction("AutoGeneration", new { yearId = toCreate.Id }) : RedirectToAction("Index", "AcademicGrade", new { toCreate.Id }));
        }