public ActionResult AddGradeToSchool(ModifySchoolGradeRequest request)
        {
            var university = _schoolService.GetSchoolById(request.UniversityId);
            var model = new NewUniversityViewModel()
            {
                UniversityId = university.SchoolId,
                UniversityName = university.Name,
                UniversityDescription = university.Description
            };

            model.Response = (ResponseMessageViewModel) request.Validate();
            if (!request.IsValid)
            {
                model.UpdateGradeList();
                return PartialView("~/Views/Partials/Management/AddGrade.cshtml", model);
            }

            _schoolService.AddGradeToSchool(request.UniversityId, request.SchoolGrade);
            model.UpdateGradeList();
            return PartialView("~/Views/Partials/Management/AddGrade.cshtml", model);
        }
        public ActionResult AddNewUniversity(AddNewUniversityRequest request, string ButtonType)
        {
            NewUniversityViewModel model = new NewUniversityViewModel();
            var response = request.Validate();
            if (!request.IsValid)
            {
                model.Response = response;
                return PartialView("~/Views/Partials/Management/AddUniversity.cshtml", model);
            }

            _schoolService.AddSchoolAndSave(request.UniversityName, request.UniversityDescription);

            switch (ButtonType)
            {
                case "saveUniversityAndExit":
                    return RedirectToAction("ManageUniversities");
                case "saveUniversityAndContinue":
                {
                    model.UniversityName = request.UniversityName;
                    model.UniversityDescription = request.UniversityDescription;
                    model.UniversityId = _schoolService.GetSchoolByName(request.UniversityName).SchoolId;

                    return PartialView("~/Views/Partials/Management/AddGrade.cshtml", model);
                }
                default:
                    return PartialView("~/Views/Partials/Management/AddUniversity.cshtml", model);
            }
        }
 public ActionResult AddNewUniversity()
 {
     var model = new NewUniversityViewModel();
     return PartialView("~/Views/Partials/Management/AddUniversity.cshtml", model);
 }
        public ActionResult DeleteGradeFromSchool(ModifySchoolGradeRequest request)
        {
            _schoolService.RemoveGradeFromSchool(request.UniversityId, request.SchoolGrade);
            var school = _schoolService.GetSchoolById(request.UniversityId);

            NewUniversityViewModel model = new NewUniversityViewModel()
            {
                UniversityId = school.SchoolId,
                UniversityName = school.Name,
                UniversityDescription = school.Description,
            };

            model.UpdateGradeList();

            return PartialView("~/Views/Partials/Management/AddGrade.cshtml", model);
        }
 public ActionResult ConfigureUniversity(int schoolId)
 {
     var school = _schoolService.GetSchoolById(schoolId);
     var newUniversityModel = new NewUniversityViewModel()
     {
         UniversityName = school.Name,
         UniversityDescription = school.Description,
         UniversityId = schoolId,
         GradeList = _schoolService.GetAllSchoolGrades(schoolId).ToList()
     };
     return PartialView("~/Views/Partials/Management/AddGrade.cshtml", newUniversityModel);
 }