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); 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(); 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); diff --git a/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js b/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js index c704ff1..26586cb 100644 --- a/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js +++ b/GrossesMitaines/grosses-mitaines-ui/src/pages/Inventaire.js @@ -33,8 +33,10 @@ const Inventaire = () => { const newMorceau = await response.json(); console.log(newMorceau); - if (response.ok) + 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); };