@@ -469,41 +469,53 @@ public async Task<IActionResult> CreateAccountRegionSelection(AccountCreationVie
469469 {
470470 var countryCheck = int . TryParse ( accountCreationViewModel . CountryId , out int countryId ) ;
471471 var accountCreation = await this . multiPageFormService . GetMultiPageFormData < AccountCreationViewModel > ( MultiPageFormDataFeature . AddRegistrationPrompt , this . TempData ) ;
472- if ( string . IsNullOrWhiteSpace ( accountCreationViewModel . CountryId ) || ! countryCheck )
472+ if ( accountCreationViewModel . CountryId != null )
473+ {
474+ accountCreation . CountryId = accountCreationViewModel . CountryId ;
475+ }
476+
477+ if ( accountCreation . CountryId == "1" )
478+ {
479+ var regionData = await this . regionService . GetAllPagedAsync ( accountCreationViewModel . CurrentPageIndex , UserRegistrationContentPageSize ) ;
480+ 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 } ) ;
481+ }
482+ else if ( string . IsNullOrWhiteSpace ( accountCreationViewModel . CountryId ) || ! countryCheck )
473483 {
474484 this . ModelState . AddModelError ( "CountryId" , CommonValidationErrorMessages . CountryRequired ) ;
475485 var countries = await this . countryService . GetFilteredAsync ( accountCreationViewModel . FilterText ) ;
476486 return this . View ( "CreateAccountCountrySelection" , new AccountCreationListViewModel { FilterText = accountCreationViewModel . FilterText , CountryList = countries . ToList ( ) , ReturnToConfirmation = accountCreationViewModel . ReturnToConfirmation } ) ;
477487 }
478-
479- accountCreation . CountryId = accountCreationViewModel . CountryId ;
480- await this . multiPageFormService . SetMultiPageFormData ( accountCreation , MultiPageFormDataFeature . AddRegistrationPrompt , this . TempData ) ;
481- if ( countryId != 1 )
488+ else
482489 {
483- accountCreationViewModel . RegionId = string . Empty ;
484- accountCreation . RegionId = string . Empty ;
490+ accountCreation . CountryId = accountCreationViewModel . CountryId ;
485491 await this . multiPageFormService . SetMultiPageFormData ( accountCreation , MultiPageFormDataFeature . AddRegistrationPrompt , this . TempData ) ;
486-
487- if ( accountCreation . IsLoginWizard )
492+ if ( countryId != 1 )
488493 {
489- return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "AccountConfirmation" , "LoginWizard" ) : this . RedirectToAction ( "NextStage" , "LoginWizard" ) ;
490- }
494+ accountCreationViewModel . RegionId = string . Empty ;
495+ accountCreation . RegionId = string . Empty ;
496+ await this . multiPageFormService . SetMultiPageFormData ( accountCreation , MultiPageFormDataFeature . AddRegistrationPrompt , this . TempData ) ;
491497
492- return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "CreateAccountConfirmation" , new AccountCreationViewModel { LocationId = accountCreation . LocationId } ) : this . RedirectToAction ( "CreateAccountSearchRole" , accountCreationViewModel ) ;
493- }
498+ if ( accountCreation . IsLoginWizard )
499+ {
500+ return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "AccountConfirmation" , "LoginWizard" ) : this . RedirectToAction ( "NextStage" , "LoginWizard" ) ;
501+ }
494502
495- switch ( accountCreationViewModel . AccountCreationPagingEnum )
496- {
497- case AccountCreationPagingEnum . NextPageChange :
498- accountCreationViewModel . CurrentPageIndex += 1 ;
499- break ;
503+ return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "CreateAccountConfirmation" , new AccountCreationViewModel { LocationId = accountCreation . LocationId } ) : this . RedirectToAction ( "CreateAccountSearchRole" , accountCreationViewModel ) ;
504+ }
500505
501- case AccountCreationPagingEnum . PreviousPageChange :
502- accountCreationViewModel . CurrentPageIndex -= 1 ;
503- break ;
504- case AccountCreationPagingEnum . Default :
505- accountCreationViewModel . CurrentPageIndex = 1 ;
506- break ;
506+ switch ( accountCreationViewModel . AccountCreationPagingEnum )
507+ {
508+ case AccountCreationPagingEnum . NextPageChange :
509+ accountCreationViewModel . CurrentPageIndex += 1 ;
510+ break ;
511+
512+ case AccountCreationPagingEnum . PreviousPageChange :
513+ accountCreationViewModel . CurrentPageIndex -= 1 ;
514+ break ;
515+ case AccountCreationPagingEnum . Default :
516+ accountCreationViewModel . CurrentPageIndex = 1 ;
517+ break ;
518+ }
507519 }
508520
509521 var region = await this . regionService . GetAllPagedAsync ( accountCreationViewModel . CurrentPageIndex , UserRegistrationContentPageSize ) ;
@@ -533,6 +545,11 @@ public async Task<IActionResult> CreateAccountSubmitRegionSelection(AccountCreat
533545 }
534546 }
535547
548+ if ( accountCreationViewModel . CountryId != null )
549+ {
550+ accountCreation . CountryId = accountCreationViewModel . CountryId ;
551+ }
552+
536553 accountCreation . RegionId = accountCreationViewModel . RegionId ;
537554 await this . multiPageFormService . SetMultiPageFormData ( accountCreation , MultiPageFormDataFeature . AddRegistrationPrompt , this . TempData ) ;
538555
@@ -546,7 +563,7 @@ public async Task<IActionResult> CreateAccountSubmitRegionSelection(AccountCreat
546563 return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "AccountConfirmation" , "LoginWizard" ) : this . RedirectToAction ( "NextStage" , "LoginWizard" ) ;
547564 }
548565
549- return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "CreateAccountConfirmation" , new AccountCreationViewModel { LocationId = accountCreation . LocationId } ) : this . RedirectToAction ( "CreateAccountSearchRole" , new AccountCreationViewModel ( ) { CountryId = accountCreation . CountryId } ) ;
566+ return this . CheckConfirmationUpdate ( ) ? this . RedirectToAction ( "CreateAccountConfirmation" , new AccountCreationViewModel { LocationId = accountCreation . LocationId } ) : this . RedirectToAction ( "CreateAccountSearchRole" , new AccountCreationViewModel ( ) { CountryId = accountCreation . CountryId , RegionId = accountCreation . RegionId } ) ;
550567 }
551568
552569 /// <summary>
@@ -581,7 +598,7 @@ public async Task<IActionResult> CreateAccountCurrentRole(AccountCreationViewMod
581598 if ( string . IsNullOrWhiteSpace ( filterText ) )
582599 {
583600 this . ModelState . AddModelError ( "FilterText" , CommonValidationErrorMessages . SearchTermRequired ) ;
584- return this . View ( "CreateAccountSearchRole" , new AccountCreationViewModel { RegionId = accountCreation . RegionId , ReturnToConfirmation = accountCreationViewModel . ReturnToConfirmation } ) ;
601+ return this . View ( "CreateAccountSearchRole" , new AccountCreationViewModel { CountryId = accountCreation . CountryId , RegionId = accountCreation . RegionId , ReturnToConfirmation = accountCreationViewModel . ReturnToConfirmation } ) ;
585602 }
586603 }
587604
@@ -598,7 +615,7 @@ public async Task<IActionResult> CreateAccountCurrentRole(AccountCreationViewMod
598615 else
599616 {
600617 this . ModelState . AddModelError ( "FilterText" , CommonValidationErrorMessages . SearchTermRequired ) ;
601- return this . View ( "CreateAccountSearchRole" , new AccountCreationViewModel { RegionId = accountCreation . RegionId , ReturnToConfirmation = accountCreationViewModel . ReturnToConfirmation } ) ;
618+ return this . View ( "CreateAccountSearchRole" , new AccountCreationViewModel { CountryId = accountCreation . CountryId , RegionId = accountCreation . RegionId , ReturnToConfirmation = accountCreationViewModel . ReturnToConfirmation } ) ;
602619 }
603620 }
604621
0 commit comments