Пример #1
0
        public ActionResult Degrees()
        {
            List <Degree>    degrees = _degreeService.GetDegrees();
            CatalogViewModel model   = new CatalogViewModel()
            {
                Degrees = degrees
            };

            return(View(model));
        }
        public ActionResult Edit()
        {
            Account account = GetAuthCookieAccount();

            if (account == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            Account impersonateAccount = Statics.ImpersonateGet(Session);

            if (impersonateAccount != null)
            {
                account = impersonateAccount;
            }

            List <Degree> availableDegrees = new List <Degree>();

            availableDegrees = _degreeService.GetDegrees();

            if (account.Degree == null || account.Degree.Id <= 0)
            {
                account.Degree = availableDegrees[0];
            }
            if (account.Concentration == null || account.Concentration.Id <= 0)
            {
                account.Concentration = availableDegrees[0].Concentrations[0];
            }

            AccountViewModel model = new AccountViewModel
            {
                Account          = account,
                AvailableDegrees = availableDegrees,
                Impersonating    = (impersonateAccount != null)
            };

            return(View(model));
        }
Пример #3
0
        public ActionResult Options(int?id)
        {
            Account account            = GetAuthCookieAccount();
            Account impersonateAccount = Statics.ImpersonateGet(Session);

            if (impersonateAccount != null)
            {
                account = impersonateAccount;
            }

            GPFSession gpfSession = new GPFSession();

            if (id.HasValue)
            {
                gpfSession = _gpfService.GetSessionById(id.Value);
            }

            List <Degree> availableDegrees = new List <Degree>();

            availableDegrees = _degreeService.GetDegrees();

            if (account != null && account.Id > 0)
            {
                gpfSession.Account       = account;
                gpfSession.Degree        = (gpfSession.Degree == null) ? account.Degree : gpfSession.Degree;
                gpfSession.Concentration = (gpfSession.Concentration == null) ? account.Concentration : gpfSession.Concentration;
            }

            if (gpfSession.Degree == null && availableDegrees != null)
            {
                gpfSession.Degree        = availableDegrees[0];
                gpfSession.Concentration = gpfSession.Degree.Concentrations[0];
            }

            List <Course> availableConcentrationCourses = new List <Course>();

            if (gpfSession.Degree != null)
            {
                availableConcentrationCourses = _courseService.GetCoursesByConcentration(gpfSession.Concentration.Id);
            }

            List <Course> availableElectiveCourses = new List <Course>();

            if (gpfSession.Degree != null && gpfSession.Concentration != null)
            {
                availableElectiveCourses = _courseService.GetAllElectivesByConcentration(gpfSession.Concentration.Id);
            }

            GPFViewModel model = new GPFViewModel()
            {
                GPFSession       = gpfSession,
                AvailableDegrees = availableDegrees,
                AvailableConcentrationCourses = availableConcentrationCourses,
                AvailableElectiveCourses      = availableElectiveCourses,
                Impersonating = (impersonateAccount != null)
            };

            if (id.HasValue)
            {
                model.EnteringYear        = gpfSession.EnteringTerm.Year;
                model.EnteringQuarter     = gpfSession.EnteringTerm.Quarter.Value;
                model.ClassesPerQuarter   = gpfSession.ClassesPerQuarter;
                model.ClassDeliveryOption = gpfSession.ClassDeliveryOption.Value;
            }

            return(View(model));
        }