From adb5c8bcc6d209f0e04b2f4a3e759965b8dce19a Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Tue, 22 Nov 2022 08:07:06 -0800 Subject: [PATCH] Update InvoiceController.cs --- .../GrossesMitainesAPI/Controllers/InvoiceController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs index 964bcc6..47dfedf 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs @@ -163,9 +163,9 @@ public class InvoiceController : Controller { foreach (var prod in sinv.ProdQuant) { // Update de quantités dans l'inventaire. ProductModel inventProd = prods.Where(x => x.Id == prod.Key).First(); - if (inventProd.Quantity > prod.Value) - badprods.Add(prod.Key, prod.Value); - if (inventProd.Quantity == prod.Value) { + if (inventProd.Quantity < prod.Value) + badprods.Add(prod.Key, inventProd.Quantity); + else if (inventProd.Quantity == prod.Value) { inventProd.Quantity = 0; inventProd.Status = inventProd.Status == ProductModel.States.Clearance ? ProductModel.States.Discontinued :