|
5 | 5 | using System.Linq; |
6 | 6 | using System.Net; |
7 | 7 | using System.Net.Http; |
| 8 | + using System.Text.RegularExpressions; |
8 | 9 | using System.Threading.Tasks; |
9 | 10 | using elfhHub.Nhs.Models.Common; |
10 | 11 | using elfhHub.Nhs.Models.Entities; |
@@ -428,6 +429,15 @@ public async Task<IActionResult> CreateAccountCountrySearch() |
428 | 429 | public async Task<IActionResult> CreateAccountCountrySelection(AccountCreationViewModel accountCreationViewModel) |
429 | 430 | { |
430 | 431 | var accountDetails = await this.multiPageFormService.GetMultiPageFormData<AccountCreationViewModel>(MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); |
| 432 | + if (!string.IsNullOrWhiteSpace(accountCreationViewModel.FilterText)) |
| 433 | + { |
| 434 | + string filterText = Regex.Replace(accountCreationViewModel.FilterText, "[:!@#$%^&*()}{|\":?><\\[\\]\\;'/.,~]", " "); |
| 435 | + if (string.IsNullOrWhiteSpace(filterText)) |
| 436 | + { |
| 437 | + this.ModelState.AddModelError("FilterText", CommonValidationErrorMessages.SearchTermRequired); |
| 438 | + return this.View("CreateAccountCountrySearch", accountCreationViewModel); |
| 439 | + } |
| 440 | + } |
431 | 441 |
|
432 | 442 | if (string.IsNullOrWhiteSpace(accountCreationViewModel.FilterText)) |
433 | 443 | { |
@@ -565,6 +575,16 @@ public async Task<IActionResult> CreateAccountSearchRole(AccountCreationViewMode |
565 | 575 | public async Task<IActionResult> CreateAccountCurrentRole(AccountCreationViewModel accountCreationViewModel) |
566 | 576 | { |
567 | 577 | var accountCreation = await this.multiPageFormService.GetMultiPageFormData<AccountCreationViewModel>(MultiPageFormDataFeature.AddRegistrationPrompt, this.TempData); |
| 578 | + if (!string.IsNullOrWhiteSpace(accountCreationViewModel.FilterText)) |
| 579 | + { |
| 580 | + string filterText = Regex.Replace(accountCreationViewModel.FilterText, "[:!@#$%^&*()}{|\":?><\\[\\]\\;'/.,~]", " "); |
| 581 | + if (string.IsNullOrWhiteSpace(filterText)) |
| 582 | + { |
| 583 | + this.ModelState.AddModelError("FilterText", CommonValidationErrorMessages.SearchTermRequired); |
| 584 | + return this.View("CreateAccountSearchRole", new AccountCreationViewModel { RegionId = accountCreation.RegionId, ReturnToConfirmation = accountCreationViewModel.ReturnToConfirmation }); |
| 585 | + } |
| 586 | + } |
| 587 | + |
568 | 588 | if (string.IsNullOrWhiteSpace(accountCreationViewModel.FilterText)) |
569 | 589 | { |
570 | 590 | var currentJobRole = int.TryParse(accountCreation.CurrentRole, out int currentRole); |
@@ -749,6 +769,18 @@ public async Task<IActionResult> CreateAccountPrimarySpecialtySelection(AccountC |
749 | 769 | } |
750 | 770 |
|
751 | 771 | var optionalSpecialty = await this.specialtyService.GetSpecialtiesAsync(); |
| 772 | + if (!string.IsNullOrWhiteSpace(accountCreationViewModel.FilterText)) |
| 773 | + { |
| 774 | + string filterText = Regex.Replace(accountCreationViewModel.FilterText, "[:!@#$%^&*()}{|\":?><\\[\\]\\;'/.,~]", " "); |
| 775 | + if (string.IsNullOrWhiteSpace(filterText)) |
| 776 | + { |
| 777 | + this.ModelState.AddModelError("PrimarySpecialtyId", CommonValidationErrorMessages.SpecialtyNotApplicable); |
| 778 | + accountCreationViewModel.RegistrationNumber = accountCreation.RegistrationNumber; |
| 779 | + accountCreationViewModel.CurrentRole = accountCreation.CurrentRole; |
| 780 | + return this.View("CreateAccountPrimarySpecialty", accountCreationViewModel); |
| 781 | + } |
| 782 | + } |
| 783 | + |
752 | 784 | if (string.IsNullOrWhiteSpace(accountCreationViewModel.FilterText)) |
753 | 785 | { |
754 | 786 | if (!string.IsNullOrWhiteSpace(accountCreation.PrimarySpecialtyId)) |
|
0 commit comments