Skip to content

Commit

Permalink
fix(register) : update secondary contact validation to work in edit flow
Browse files Browse the repository at this point in the history
  • Loading branch information
KobithasanVasantharajah committed Dec 17, 2024
1 parent 50fa128 commit 4b1c20a
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions DVSRegister/Controllers/CabProviderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,21 +692,21 @@ public async Task<IActionResult> 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"
)
);

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"
)
Expand All @@ -726,16 +726,15 @@ public async Task<IActionResult> 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
Expand Down Expand Up @@ -782,21 +781,21 @@ public async Task<IActionResult> 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"
)
);

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"
)
Expand All @@ -814,14 +813,14 @@ public async Task<IActionResult> 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);
}
}

Expand Down

0 comments on commit 4b1c20a

Please sign in to comment.