Skip to content

Commit

Permalink
Remove double error message - checkout page
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofPajak committed Oct 21, 2021
1 parent 42c3da5 commit 0684210
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Web/Grand.Web/Controllers/CheckoutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ public virtual async Task<IActionResult> SaveBilling(IFormCollection form)
else
{
//new address
ModelState.Clear();
var model = new CheckoutBillingAddressModel();
await TryUpdateModelAsync(model.NewAddress, "BillingNewAddress");

Expand All @@ -521,8 +522,6 @@ public virtual async Task<IActionResult> SaveBilling(IFormCollection form)
ModelState.AddModelError("", error);
}

//validate model
TryValidateModel(model.NewAddress);
if (!ModelState.IsValid)
{
//model is not valid. redisplay the form with errors
Expand Down Expand Up @@ -675,9 +674,7 @@ public virtual async Task<IActionResult> SaveShipping(CheckoutShippingAddressMod
{
ModelState.AddModelError("", error);
}

//validate model
TryValidateModel(model.NewAddress);

if (!ModelState.IsValid)
{
var errors = ModelState.Values.SelectMany(v => v.Errors);
Expand Down

0 comments on commit 0684210

Please sign in to comment.