Skip to content

Commit 08fb6fd

Browse files
committed
Merge pull request #151 from TechnologyEnhancedLearning/Develop/Fixes/TD-3744-Jobrolewithslashincauseserrorduringregistration
TD-3744-Job role with slash in causes error during registration
1 parent 60141fc commit 08fb6fd

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
@@ -4,6 +4,7 @@
44

55
namespace LearningHub.Nhs.WebUI.Controllers
66
{
7+
using System;
78
using System.Collections.Generic;
89
using System.Linq;
910
using System.Net;
@@ -1236,7 +1237,17 @@ private async Task<AccountCreationConfirmation> GetAccountConfirmationDetails(Ac
12361237
var employer = await this.locationService.GetByIdAsync(int.TryParse(accountCreationViewModel.LocationId, out int primaryEmploymentId) ? primaryEmploymentId : 0);
12371238
var region = await this.regionService.GetAllAsync();
12381239
var specialty = await this.specialtyService.GetSpecialtiesAsync();
1239-
var role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
1240+
var role = new Tuple<int, List<JobRoleBasicViewModel>>(0, null);
1241+
if (!string.IsNullOrEmpty(accountCreationViewModel.CurrentRoleName) && accountCreationViewModel.CurrentRoleName.Contains('/'))
1242+
{
1243+
string jobrole = accountCreationViewModel.CurrentRoleName.Replace("/", " ");
1244+
role = await this.jobRoleService.GetPagedFilteredAsync(jobrole, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
1245+
}
1246+
else
1247+
{
1248+
role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
1249+
}
1250+
12401251
if (role.Item1 > 0)
12411252
{
12421253
accountCreationViewModel.CurrentRoleName = role.Item2.FirstOrDefault(x => x.Id == int.Parse(accountCreationViewModel.CurrentRole)).NameWithStaffGroup;

0 commit comments

Comments
 (0)