Skip to content

Commit 9940164

Browse files
committed
TD-5133: Issue not showing the role on 'select for your current role' screen when changed the country
1 parent c07874e commit 9940164

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

LearningHub.Nhs.WebUI/Controllers/AccountController.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,18 @@ public async Task<IActionResult> CreateAccountSearchRole(AccountCreationViewMode
581581
{
582582
var accountCreation = await this.multiPageFormService.GetMultiPageFormData<AccountCreationViewModel>(MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData);
583583

584-
return this.View("CreateAccountSearchRole", new AccountCreationViewModel { CountryId = accountCreationViewModel.CountryId });
584+
var currentJobRole = int.TryParse(accountCreation.CurrentRole, out int currentRole);
585+
if (currentJobRole && currentRole > 0)
586+
{
587+
var filterText = await this.jobRoleService.GetByIdAsync(currentRole);
588+
accountCreationViewModel.FilterText = filterText.Name;
589+
var jobrole = await this.jobRoleService.GetByIdAsync(currentRole);
590+
return this.View("CreateAccountCurrentRole", new AccountCreationListViewModel { RoleList = new List<JobRoleBasicViewModel> { jobrole }, AccountCreationPaging = new AccountCreationPagingModel { TotalItems = 1, PageSize = UserRegistrationContentPageSize, HasItems = jobrole != null, CurrentPage = 1 }, CurrentRole = accountCreation.CurrentRole, CountryId = accountCreation.CountryId, RegionId = accountCreation.RegionId, FilterText = accountCreationViewModel.FilterText, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation });
591+
}
592+
else
593+
{
594+
return this.View("CreateAccountSearchRole", new AccountCreationViewModel { CountryId = accountCreationViewModel.CountryId });
595+
}
585596
}
586597

587598
/// <summary>

0 commit comments

Comments
 (0)