public async Task <IActionResult> Index()
        {
            if (frontendUrlService.ShouldRedirectOrganisationShow())
            {
                return(frontendUrlService.RedirectToFrontend("/organisations"));
            }

            var orgs = await _manageApi.GetProviderSummaries();

            var model = new OrganisationListViewModel
            {
                ProviderSummaries = orgs
            };

            return(View(model));
        }
コード例 #2
0
        public async Task <ActionResult> Index()
        {
            IEnumerable <ProviderSummary> orgs;

            try
            {
                orgs = await _manageApi.GetProviderSummaries();
            }
            catch (ManageCoursesApiException e)
            {
                if ((int)e.StatusCode == 401)
                {
                    return(StatusCode(401));
                }
                else
                {
                    throw;
                }
            }

            var userOrganisations = orgs.ToList();

            if (userOrganisations.Count() == 1)
            {
                return(this.RedirectToAction("Show", "Organisation", new { providerCode = userOrganisations[0].ProviderCode }));
            }

            if (userOrganisations.Count() > 1)
            {
                return(this.RedirectToAction("Index", "Organisation"));
            }

            return(StatusCode(401));
        }