Ejemplo n.º 1
0
        public async Task <ActionResult> GoToNextStep(string nextStep, string hashedAccountId, string organisationName, string hashedAgreementId)
        {
            var userId = OwinWrapper.GetClaimValue(ControllerConstants.UserRefClaimKeyName);

            var userShownWizard = await _orchestrator.UserShownWizard(userId, hashedAccountId);

            switch (nextStep)
            {
            case "agreement": return(RedirectToAction(ControllerConstants.AboutYourAgreement, ControllerConstants.EmployerAgreementControllerName, new { agreementid = hashedAgreementId }));

            case "teamMembers": return(RedirectToAction(ControllerConstants.ViewTeamActionName, ControllerConstants.EmployerTeamControllerName, new { hashedAccountId }));

            case "addOrganisation": return(RedirectToAction(ControllerConstants.SearchForOrganisationActionName, ControllerConstants.SearchOrganisationControllerName, new { hashedAccountId }));

            case "dashboard": return(RedirectToAction(ControllerConstants.IndexActionName, ControllerConstants.EmployerTeamControllerName, new { hashedAccountId }));

            default:
                var errorMessage = "Please select one of the next steps below";
                return(View(ControllerConstants.OrganisationAddedNextStepsViewName, new OrchestratorResponse <OrganisationAddedNextStepsViewModel>
                {
                    Data = new OrganisationAddedNextStepsViewModel {
                        ErrorMessage = errorMessage, OrganisationName = organisationName, ShowWizard = userShownWizard, HashedAgreementId = hashedAgreementId
                    },
                    FlashMessage = new FlashMessageViewModel
                    {
                        Headline = "Invalid next step chosen",
                        Message = errorMessage,
                        ErrorMessages = new Dictionary <string, string> {
                            { "nextStep", errorMessage }
                        },
                        Severity = FlashMessageSeverityLevel.Error
                    }
                }));
            }
        }