From c1d5ffd1253d8b74ce5b12c97029f8b78499b63a Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Wed, 23 Nov 2022 16:53:22 -0800 Subject: [PATCH] Update InvoiceController.cs --- .../GrossesMitainesAPI/Controllers/InvoiceController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs index aa24d95..567efe0 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/InvoiceController.cs @@ -158,6 +158,13 @@ public class InvoiceController : Controller { return BadRequest(); } + foreach (var prod in prods) { + inv.Products.Add(new() { + Product = prod, + Quantity = sinv.ProdQuant.First(x => x.Key == prod.Id).Value + }); + } + if (prods.Count == 0) return BadRequest("Vous devez inclure au moins un produit à votre commande.");