diff --git a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs index 179850674..1281d1d18 100644 --- a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs @@ -469,41 +469,53 @@ public async Task CreateAccountRegionSelection(AccountCreationVie { var countryCheck = int.TryParse(accountCreationViewModel.CountryId, out int countryId); var accountCreation = await this.multiPageFormService.GetMultiPageFormData(MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); - if (string.IsNullOrWhiteSpace(accountCreationViewModel.CountryId) || !countryCheck) + if (accountCreationViewModel.CountryId != null) + { + accountCreation.CountryId = accountCreationViewModel.CountryId; + } + + if (accountCreation.CountryId == "1") + { + var regionData = await this.regionService.GetAllPagedAsync(accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize); + return this.View(new AccountCreationListViewModel { Region = regionData.Item2, AccountCreationPaging = new AccountCreationPagingModel { TotalItems = regionData.Item1, PageSize = UserRegistrationContentPageSize, HasItems = regionData.Item1 > 0, CurrentPage = accountCreationViewModel.CurrentPageIndex }, RegionId = accountCreation.RegionId, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); + } + else if (string.IsNullOrWhiteSpace(accountCreationViewModel.CountryId) || !countryCheck) { this.ModelState.AddModelError("CountryId", CommonValidationErrorMessages.CountryRequired); var countries = await this.countryService.GetFilteredAsync(accountCreationViewModel.FilterText); return this.View("CreateAccountCountrySelection", new AccountCreationListViewModel { FilterText = accountCreationViewModel.FilterText, CountryList = countries.ToList(), ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); } - - accountCreation.CountryId = accountCreationViewModel.CountryId; - await this.multiPageFormService.SetMultiPageFormData(accountCreation, MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); - if (countryId != 1) + else { - accountCreationViewModel.RegionId = string.Empty; - accountCreation.RegionId = string.Empty; + accountCreation.CountryId = accountCreationViewModel.CountryId; await this.multiPageFormService.SetMultiPageFormData(accountCreation, MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); - - if (accountCreation.IsLoginWizard) + if (countryId != 1) { - return this.CheckConfirmationUpdate() ? this.RedirectToAction("AccountConfirmation", "LoginWizard") : this.RedirectToAction("NextStage", "LoginWizard"); - } + accountCreationViewModel.RegionId = string.Empty; + accountCreation.RegionId = string.Empty; + await this.multiPageFormService.SetMultiPageFormData(accountCreation, MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); - return this.CheckConfirmationUpdate() ? this.RedirectToAction("CreateAccountConfirmation", new AccountCreationViewModel { LocationId = accountCreation.LocationId }) : this.RedirectToAction("CreateAccountSearchRole", accountCreationViewModel); - } + if (accountCreation.IsLoginWizard) + { + return this.CheckConfirmationUpdate() ? this.RedirectToAction("AccountConfirmation", "LoginWizard") : this.RedirectToAction("NextStage", "LoginWizard"); + } - switch (accountCreationViewModel.AccountCreationPagingEnum) - { - case AccountCreationPagingEnum.NextPageChange: - accountCreationViewModel.CurrentPageIndex += 1; - break; + return this.CheckConfirmationUpdate() ? this.RedirectToAction("CreateAccountConfirmation", new AccountCreationViewModel { LocationId = accountCreation.LocationId }) : this.RedirectToAction("CreateAccountSearchRole", accountCreationViewModel); + } - case AccountCreationPagingEnum.PreviousPageChange: - accountCreationViewModel.CurrentPageIndex -= 1; - break; - case AccountCreationPagingEnum.Default: - accountCreationViewModel.CurrentPageIndex = 1; - break; + switch (accountCreationViewModel.AccountCreationPagingEnum) + { + case AccountCreationPagingEnum.NextPageChange: + accountCreationViewModel.CurrentPageIndex += 1; + break; + + case AccountCreationPagingEnum.PreviousPageChange: + accountCreationViewModel.CurrentPageIndex -= 1; + break; + case AccountCreationPagingEnum.Default: + accountCreationViewModel.CurrentPageIndex = 1; + break; + } } var region = await this.regionService.GetAllPagedAsync(accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize); @@ -533,6 +545,11 @@ public async Task CreateAccountSubmitRegionSelection(AccountCreat } } + if (accountCreationViewModel.CountryId != null) + { + accountCreation.CountryId = accountCreationViewModel.CountryId; + } + accountCreation.RegionId = accountCreationViewModel.RegionId; await this.multiPageFormService.SetMultiPageFormData(accountCreation, MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); @@ -546,7 +563,7 @@ public async Task CreateAccountSubmitRegionSelection(AccountCreat return this.CheckConfirmationUpdate() ? this.RedirectToAction("AccountConfirmation", "LoginWizard") : this.RedirectToAction("NextStage", "LoginWizard"); } - return this.CheckConfirmationUpdate() ? this.RedirectToAction("CreateAccountConfirmation", new AccountCreationViewModel { LocationId = accountCreation.LocationId }) : this.RedirectToAction("CreateAccountSearchRole", new AccountCreationViewModel() { CountryId = accountCreation.CountryId }); + return this.CheckConfirmationUpdate() ? this.RedirectToAction("CreateAccountConfirmation", new AccountCreationViewModel { LocationId = accountCreation.LocationId }) : this.RedirectToAction("CreateAccountSearchRole", new AccountCreationViewModel() { CountryId = accountCreation.CountryId, RegionId = accountCreation.RegionId }); } /// @@ -581,7 +598,7 @@ public async Task CreateAccountCurrentRole(AccountCreationViewMod if (string.IsNullOrWhiteSpace(filterText)) { this.ModelState.AddModelError("FilterText", CommonValidationErrorMessages.SearchTermRequired); - return this.View("CreateAccountSearchRole", new AccountCreationViewModel { RegionId = accountCreation.RegionId, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); + return this.View("CreateAccountSearchRole", new AccountCreationViewModel { CountryId = accountCreation.CountryId, RegionId = accountCreation.RegionId, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); } } @@ -598,7 +615,7 @@ public async Task CreateAccountCurrentRole(AccountCreationViewMod else { this.ModelState.AddModelError("FilterText", CommonValidationErrorMessages.SearchTermRequired); - return this.View("CreateAccountSearchRole", new AccountCreationViewModel { RegionId = accountCreation.RegionId, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); + return this.View("CreateAccountSearchRole", new AccountCreationViewModel { CountryId = accountCreation.CountryId, RegionId = accountCreation.RegionId, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); } } diff --git a/LearningHub.Nhs.WebUI/Views/Account/CreateAccountSearchRole.cshtml b/LearningHub.Nhs.WebUI/Views/Account/CreateAccountSearchRole.cshtml index c8b48178e..e42fd6f45 100644 --- a/LearningHub.Nhs.WebUI/Views/Account/CreateAccountSearchRole.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Account/CreateAccountSearchRole.cshtml @@ -15,7 +15,16 @@
- + @if (Model.CountryId == "1") + { + + + } + else + { + + + } @if (errorHasOccurred) { diff --git a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationGradePaging.cshtml b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationGradePaging.cshtml index 003a78163..27c856aee 100644 --- a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationGradePaging.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationGradePaging.cshtml @@ -24,8 +24,6 @@ } } -@if (showPaging == true) -{ -} diff --git a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationJobRolePaging.cshtml b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationJobRolePaging.cshtml index 9232336fb..a8bc8a9ae 100644 --- a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationJobRolePaging.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationJobRolePaging.cshtml @@ -24,8 +24,6 @@ } } -@if (showPaging == true) -{ -} - diff --git a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationRegionPaging.cshtml b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationRegionPaging.cshtml index 3a3ea02f8..47a4aded4 100644 --- a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationRegionPaging.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationRegionPaging.cshtml @@ -24,8 +24,6 @@ } } -@if (showPaging == true) -{ -} diff --git a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationSpecialtyPaging.cshtml b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationSpecialtyPaging.cshtml index 0c5f04028..6227b3773 100644 --- a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationSpecialtyPaging.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationSpecialtyPaging.cshtml @@ -24,8 +24,6 @@ } } -@if (showPaging == true) -{ -} diff --git a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationWorkPlacePaging.cshtml b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationWorkPlacePaging.cshtml index ac9518fe8..de4830446 100644 --- a/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationWorkPlacePaging.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Account/_AccountCreationWorkPlacePaging.cshtml @@ -24,8 +24,6 @@ } } -@if (showPaging == true) -{ -}