public IActionResult PostCompleted(ReservationsRouteModel routeModel, CompletedViewModel model)
        {
            if (!ModelState.IsValid)
            {
                var viewName = routeModel.UkPrn.HasValue ? ViewNames.ProviderCompleted : ViewNames.EmployerCompleted;
                return(View(viewName, model));
            }

            switch (model.WhatsNext)
            {
            case CompletedReservationWhatsNext.RecruitAnApprentice:
                var recruitUrl = routeModel.UkPrn.HasValue
                        ? _urlHelper.GenerateUrl(new UrlParameters {
                    SubDomain = "recruit",
                    Id        = routeModel.UkPrn.ToString()
                })
                        : _urlHelper.GenerateUrl(new UrlParameters {
                    SubDomain = "recruit",
                    Folder    = "accounts",
                    Id        = routeModel.EmployerAccountId
                });

                return(Redirect(recruitUrl));

            case CompletedReservationWhatsNext.FindApprenticeshipTraining:
                return(Redirect(_configuration.FindApprenticeshipTrainingUrl));

            case CompletedReservationWhatsNext.AddAnApprentice:
                var addApprenticeUrl = _urlHelper.GenerateAddApprenticeUrl(routeModel.Id.Value,
                                                                           routeModel.AccountLegalEntityPublicHashedId, model.CourseId, model.UkPrn, model.StartDate,
                                                                           model.CohortRef, routeModel.EmployerAccountId, routeModel.UkPrn == null && model.UkPrn != null,
                                                                           journeyData: model.JourneyData);
                return(Redirect(addApprenticeUrl));

            default:
                var homeUrl = _urlHelper.GenerateDashboardUrl(routeModel.EmployerAccountId);
                return(Redirect(homeUrl));
            }
        }
Пример #2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            base.Process(context, output);

            var urlParams = new UrlParameters
            {
                Id          = ExternalId,
                Controller  = ExternalController,
                Action      = ExternalAction,
                SubDomain   = ExternalSubDomain,
                Folder      = ExternalFolder,
                QueryString = QueryString
            };

            output.Attributes.SetAttribute("href", _helper.GenerateUrl(urlParams));
        }
        public IActionResult CourseGuidance(ReservationsRouteModel routeModel)
        {
            var model = new CourseGuidanceViewModel
            {
                DashboardUrl           = _urlHelper.GenerateDashboardUrl(routeModel.EmployerAccountId),
                BackRouteName          = RouteNames.EmployerSelectCourse,
                ProviderPermissionsUrl = _urlHelper.GenerateUrl(new UrlParameters
                {
                    SubDomain  = "permissions",
                    Controller = "providers",
                    Id         = routeModel.EmployerAccountId,
                    Folder     = "accounts"
                }),
                FindApprenticeshipTrainingUrl = _config.FindApprenticeshipTrainingUrl
            };

            return(View("CourseGuidance", model));
        }