From 4b1c20a3d1a87555a080017aee50be411e7c73f6 Mon Sep 17 00:00:00 2001 From: KobithasanVasantharajah Date: Tue, 17 Dec 2024 11:55:39 +0000 Subject: [PATCH] fix(register) : update secondary contact validation to work in edit flow --- .../Controllers/CabProviderController.cs | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/DVSRegister/Controllers/CabProviderController.cs b/DVSRegister/Controllers/CabProviderController.cs index f1045e7..fe48241 100644 --- a/DVSRegister/Controllers/CabProviderController.cs +++ b/DVSRegister/Controllers/CabProviderController.cs @@ -692,10 +692,10 @@ public async Task UpdatePrimaryContact(PrimaryContactViewModel pr ValidationHelper.ValidateDuplicateFields( ModelState, - primaryValue: primaryContactViewModel.PrimaryContactEmail, - secondaryValue: providerProfileDto.SecondaryContactEmail, + primaryValue: primaryContactViewModel.PrimaryContactEmail, + secondaryValue: providerProfileDto.SecondaryContactEmail, new ValidationHelper.FieldComparisonConfig( - "PrimaryContactEmail", + "PrimaryContactEmail", "SecondaryContactEmail", "Email address of secondary contact cannot be the same as primary contact" ) @@ -703,10 +703,10 @@ public async Task UpdatePrimaryContact(PrimaryContactViewModel pr ValidationHelper.ValidateDuplicateFields( ModelState, - primaryValue: primaryContactViewModel.PrimaryContactTelephoneNumber, - secondaryValue: providerProfileDto.SecondaryContactTelephoneNumber, + primaryValue: primaryContactViewModel.PrimaryContactTelephoneNumber, + secondaryValue: providerProfileDto.SecondaryContactTelephoneNumber, new ValidationHelper.FieldComparisonConfig( - "PrimaryContactTelephoneNumber", + "PrimaryContactTelephoneNumber", "SecondaryContactTelephoneNumber", "Telephone number of secondary contact cannot be the same as primary contact" ) @@ -726,16 +726,15 @@ public async Task UpdatePrimaryContact(PrimaryContactViewModel pr } else { - return RedirectToAction("CabHandleException", "Error"); + return RedirectToAction("CabHandleException", "Error"); } } else { - return View("EditPrimaryContact", primaryContactViewModel); + return View("EditPrimaryContact", primaryContactViewModel); } } - - + #endregion #region Edit secondary contact @@ -782,10 +781,10 @@ public async Task UpdateSecondaryContact(SecondaryContactViewMode ValidationHelper.ValidateDuplicateFields( ModelState, - primaryValue: providerProfileDto.PrimaryContactEmail, - secondaryValue: secondaryContactViewModel.SecondaryContactEmail, + primaryValue: providerProfileDto.PrimaryContactEmail, + secondaryValue: secondaryContactViewModel.SecondaryContactEmail, new ValidationHelper.FieldComparisonConfig( - "PrimaryContactEmail", + "PrimaryContactEmail", "SecondaryContactEmail", "Email address of secondary contact cannot be the same as primary contact" ) @@ -793,10 +792,10 @@ public async Task UpdateSecondaryContact(SecondaryContactViewMode ValidationHelper.ValidateDuplicateFields( ModelState, - primaryValue: providerProfileDto.PrimaryContactTelephoneNumber, - secondaryValue: secondaryContactViewModel.SecondaryContactTelephoneNumber, + primaryValue: providerProfileDto.PrimaryContactTelephoneNumber, + secondaryValue: secondaryContactViewModel.SecondaryContactTelephoneNumber, new ValidationHelper.FieldComparisonConfig( - "PrimaryContactTelephoneNumber", + "PrimaryContactTelephoneNumber", "SecondaryContactTelephoneNumber", "Telephone number of secondary contact cannot be the same as primary contact" ) @@ -814,14 +813,14 @@ public async Task UpdateSecondaryContact(SecondaryContactViewMode { return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); } - else + else { - return RedirectToAction("CabHandleException", "Error"); + return RedirectToAction("CabHandleException", "Error"); } } else { - return View("EditSecondaryContact", secondaryContactViewModel); + return View("EditSecondaryContact", secondaryContactViewModel); } }