diff --git a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs index bcc43b6e6..b6d22f883 100644 --- a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs @@ -1265,17 +1265,7 @@ private async Task GetAccountConfirmationDetails(Ac var employer = await this.locationService.GetByIdAsync(int.TryParse(accountCreationViewModel.LocationId, out int primaryEmploymentId) ? primaryEmploymentId : 0); var region = await this.regionService.GetAllAsync(); var specialty = await this.specialtyService.GetSpecialtiesAsync(); - var role = new Tuple>(0, null); - if (!string.IsNullOrEmpty(accountCreationViewModel.CurrentRoleName) && accountCreationViewModel.CurrentRoleName.Contains('/')) - { - string jobrole = accountCreationViewModel.CurrentRoleName.Replace("/", " "); - role = await this.jobRoleService.GetPagedFilteredAsync(jobrole, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize); - } - else - { - role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize); - } - + var role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize); if (role.Item1 > 0) { accountCreationViewModel.CurrentRoleName = role.Item2.FirstOrDefault(x => x.Id == int.Parse(accountCreationViewModel.CurrentRole)).NameWithStaffGroup; diff --git a/LearningHub.Nhs.WebUI/Services/JobRoleService.cs b/LearningHub.Nhs.WebUI/Services/JobRoleService.cs index bd4a2e689..bbf9f4402 100644 --- a/LearningHub.Nhs.WebUI/Services/JobRoleService.cs +++ b/LearningHub.Nhs.WebUI/Services/JobRoleService.cs @@ -4,9 +4,12 @@ using System.Collections.Generic; using System.Threading.Tasks; using elfhHub.Nhs.Models.Common; + using LearningHub.Nhs.WebUI.Helpers; using LearningHub.Nhs.WebUI.Interfaces; + using LearningHub.Nhs.WebUI.Models.Account; using Microsoft.Extensions.Logging; using Newtonsoft.Json; + using NuGet.Common; /// /// Defines the . @@ -101,7 +104,7 @@ public async Task>> GetPagedFilteredAsync var client = await this.userApiHttpClient.GetClientAsync(); - var request = $"JobRole/GetPagedFilteredWithStaffGroup/{filter}/{page}/{pageSize}"; + var request = $"JobRole/GetPagedFilteredWithStaffGroup/{Uri.EscapeDataString(filter.EncodeParameter())}/{page}/{pageSize}"; var response = await client.GetAsync(request).ConfigureAwait(false); if (response.IsSuccessStatusCode)