public IHttpActionResult GetEdOrgs()
        {
            var edOrgs = _edOrgService.GetAuthorizedEdOrgs()
                         .DistinctBy(x => x.OrganizationName)
                         .OrderBy(x => x.OrganizationName);

            return(Json(edOrgs));
        }
示例#2
0
        public ActionResult NavDropDowns()
        {
            var model = new NavMenusViewModel
            {
                AppUserSession = _appUserService.GetSession(),
                EdOrgs         = _edOrgService.GetAuthorizedEdOrgs(),
                SchoolYears    = _schoolYearService.GetSubmittableSchoolYears().OrderByDescending(x => x.EndYear)
            };

            // Set focused information after using the service to initialize the model.
            model.FocusedEdOrg = model.EdOrgs.FirstOrDefault(edOrg => edOrg.Id == _appUserService.GetSession().FocusedEdOrgId);

            // If the user's School Year wasn't available any more, then select the first School Year whose data can be submitted.
            model.FocusedSchoolYear = model.SchoolYears
                                      .FirstOrDefault(sy => sy.Id == _appUserService.GetSession().FocusedSchoolYearId) ??
                                      _schoolYearService.GetSubmittableSchoolYears().First();

            model.ShowLogoutLink = _configurationValues.UseSimulatedSSO;

            return(PartialView("_NavDropDowns", model));
        }