Skip to content

Commit 5b7b35a

Browse files
authored
Merge pull request #213 from TechnologyEnhancedLearning/Develop/Fixes/TD-3744-JobRoleError
TD-3744-Job role with slash in causes error during registration
2 parents aac8a9f + dfafe64 commit 5b7b35a

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

LearningHub.Nhs.WebUI/Controllers/AccountController.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,17 +1265,7 @@ private async Task<AccountCreationConfirmation> GetAccountConfirmationDetails(Ac
12651265
var employer = await this.locationService.GetByIdAsync(int.TryParse(accountCreationViewModel.LocationId, out int primaryEmploymentId) ? primaryEmploymentId : 0);
12661266
var region = await this.regionService.GetAllAsync();
12671267
var specialty = await this.specialtyService.GetSpecialtiesAsync();
1268-
var role = new Tuple<int, List<JobRoleBasicViewModel>>(0, null);
1269-
if (!string.IsNullOrEmpty(accountCreationViewModel.CurrentRoleName) && accountCreationViewModel.CurrentRoleName.Contains('/'))
1270-
{
1271-
string jobrole = accountCreationViewModel.CurrentRoleName.Replace("/", " ");
1272-
role = await this.jobRoleService.GetPagedFilteredAsync(jobrole, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
1273-
}
1274-
else
1275-
{
1276-
role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
1277-
}
1278-
1268+
var role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
12791269
if (role.Item1 > 0)
12801270
{
12811271
accountCreationViewModel.CurrentRoleName = role.Item2.FirstOrDefault(x => x.Id == int.Parse(accountCreationViewModel.CurrentRole)).NameWithStaffGroup;

LearningHub.Nhs.WebUI/Services/JobRoleService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
using System.Collections.Generic;
55
using System.Threading.Tasks;
66
using elfhHub.Nhs.Models.Common;
7+
using LearningHub.Nhs.WebUI.Helpers;
78
using LearningHub.Nhs.WebUI.Interfaces;
9+
using LearningHub.Nhs.WebUI.Models.Account;
810
using Microsoft.Extensions.Logging;
911
using Newtonsoft.Json;
12+
using NuGet.Common;
1013

1114
/// <summary>
1215
/// Defines the <see cref="JobRoleService" />.
@@ -101,7 +104,7 @@ public async Task<Tuple<int, List<JobRoleBasicViewModel>>> GetPagedFilteredAsync
101104

102105
var client = await this.userApiHttpClient.GetClientAsync();
103106

104-
var request = $"JobRole/GetPagedFilteredWithStaffGroup/{filter}/{page}/{pageSize}";
107+
var request = $"JobRole/GetPagedFilteredWithStaffGroup/{Uri.EscapeDataString(filter.EncodeParameter())}/{page}/{pageSize}";
105108
var response = await client.GetAsync(request).ConfigureAwait(false);
106109

107110
if (response.IsSuccessStatusCode)

0 commit comments

Comments
 (0)