From a654c663e2e073e53eb04bfd7d835f0bd3f7a253 Mon Sep 17 00:00:00 2001 From: AnjuJose011 <154979799+AnjuJose011@users.noreply.github.com> Date: Tue, 19 Mar 2024 19:35:43 +0000 Subject: [PATCH 1/2] fixes-UnknownError --- .../Controllers/AccountController.cs | 11 +---------- LearningHub.Nhs.WebUI/Services/JobRoleService.cs | 5 ++++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs index bcc43b6e6..c15c3cdce 100644 --- a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs @@ -1266,16 +1266,7 @@ private async Task GetAccountConfirmationDetails(Ac 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); - } - + 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) From dfafe646b380181b520154ddae73b6c8d946a672 Mon Sep 17 00:00:00 2001 From: AnjuJose011 <154979799+AnjuJose011@users.noreply.github.com> Date: Tue, 19 Mar 2024 19:38:03 +0000 Subject: [PATCH 2/2] fixes-UnknownError --- LearningHub.Nhs.WebUI/Controllers/AccountController.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs index c15c3cdce..b6d22f883 100644 --- a/LearningHub.Nhs.WebUI/Controllers/AccountController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/AccountController.cs @@ -1265,8 +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); - 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;