From 3d15b740f002a55cea99a6121e6d61a63f88e359 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 18 Oct 2022 12:11:49 -0400 Subject: [PATCH 1/4] mAsageee --- .../grosses-mitaines-ui/src/pages/Inventaire.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js index 8223a95..66f7cb8 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js @@ -29,12 +29,13 @@ const Inventaire = () => { }, body: JSON.stringify(morceau) }) - - const newMorceau = await response.json(); - console.log(newMorceau); - if (response.ok) + const newMorceau = await response.json(); + + if (response.ok) { setMorceaux([...morceaux, { ...newMorceau }]); + console.log("Ajout de l'item avec succès: \r\n" + newMorceau); + } else console.log("Erreur de creation " + morceau); }; @@ -45,9 +46,9 @@ const Inventaire = () => { const deletedId = await response.json(); - if (response.ok){ + if (response.ok) { setMorceaux(morceaux.filter((morceau) => morceau.id !== deletedId)); - console.log("DELETE de: "+deletedId +" avec succès!"); + console.log("DELETE de: " + deletedId + " avec succès!"); } else console.log("Erreur leur du DELETE de " + id); From c6bd14d15fb6a4a49b685fd7d86f4b0df9b2ce67 Mon Sep 17 00:00:00 2001 From: Victor Turgeon Date: Tue, 18 Oct 2022 12:19:56 -0400 Subject: [PATCH 2/4] Put to Patch --- .../GrossesMitainesAPI/Controllers/ProductController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/ProductController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/ProductController.cs index 9dfc87c..ce03481 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/ProductController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/ProductController.cs @@ -54,8 +54,8 @@ public class ProductController : ControllerBase { } [EnableCors("_myAllowSpecificOrigins")] - [HttpPut(Name = "Product")] - public ActionResult Put(Product prod) { + [HttpPatch(Name = "Product")] + public ActionResult Patch(Product prod) { try { _context.Products.Update(prod); _context.SaveChanges(); From 93f358f9901ef0bb597520e1c4c23e23248f540a Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Tue, 18 Oct 2022 12:15:57 -0700 Subject: [PATCH 3/4] moneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoneymoney --- .../GrossesMitainesAPI/Controllers/InventoryController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs index 40baa59..5869410 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs @@ -62,10 +62,10 @@ public class InventoryController : Controller { switch (order) { case "Price": - ret = ret.OrderBy(x => x.Status == Product.States.Promotion? x.PromoPrice: x.Price); + ret = ret.OrderBy(x => x.Status == Product.States.Promotion || x.Status == Product.States.Clearance? x.PromoPrice: x.Price); break; case "PriceDesc": - ret = ret.OrderByDescending(x => x.Status == Product.States.Promotion ? x.PromoPrice : x.Price); + ret = ret.OrderByDescending(x => x.Status == Product.States.Promotion || x.Status == Product.States.Clearance ? x.PromoPrice : x.Price); break; case "Title": ret = ret.OrderBy(x => x.Title); From bd1b2edfea5c36e0408df5f04fcc5dfe5fc4fb73 Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Tue, 18 Oct 2022 12:19:19 -0700 Subject: [PATCH 4/4] VROOM VROOM --- .../GrossesMitainesAPI/Controllers/SearchController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs index a40b7a4..35f23dc 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs @@ -42,16 +42,16 @@ public class SearchController : Controller { query = query.ToLower(); foreach (Product prod in _searchCache) { - string sTitle = prod.Title.Replace(".", " ").Replace(",", " ").ToLower(), - sCat = prod.Category.Replace(".", " ").Replace(",", " ").ToLower(), + string sTitle = prod.Title.Replace(",", " ").ToLower(), + sCat = prod.Category.ToLower(), sDesc = prod.Description.Replace(".", " ").Replace(",", " ").ToLower(); if (sTitle.StartsWith(query)) products.Add(prod); else if (sTitle.Contains(" " + query + " ")) title.Add(prod); - else if (sDesc.Contains(" " + query + " ")) + else if (sDesc.StartsWith(query) || sDesc.Contains(" " + query + " ")) desc.Add(prod); - else if (sCat.Contains(" " + query + " ")) + else if (sCat.Contains(query)) cat.Add(prod); } products.AddRange(title);