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 :