diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs index dc3be9a..6aafcb5 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/InventoryController.cs @@ -20,7 +20,7 @@ public class InventoryController : Controller { [EnableCors("_myAllowSpecificOrigins")] [HttpGet(Name = "Inventory")] // Pour faire des calls async par paquet de AMOUNT (5) (pour du loading en scrollant) - public IEnumerable Get(int? lastId, string? order, string? filterPrice, string? filterState) { + public IEnumerable Get(int? lastId, string? order, string? filterPrice, string? filterState, bool? all) { const int AMOUNT = 5; var ret = _context.Products.AsQueryable(); @@ -95,6 +95,8 @@ public class InventoryController : Controller { if (prod.Id == lastId) yup = true; } + else if (all.HasValue && all == true) + lst = ret.ToList(); else lst = ret.Take(AMOUNT).ToList(); return lst; diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs index 7baeb70..485c05d 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs @@ -31,8 +31,12 @@ public class SearchController : Controller { if (preview.HasValue && preview == true) products = _context.Products.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToList(); else { - products = _context.Products.Where(x => x.Title.Contains(query)).ToList(); - + products = _context.Products.Where(x => x.Title.Replace(".", " ") + .Replace(",", " ") + .ToUpper() + .Contains(" " + query.ToUpper() + " ")) + .ToList(); + foreach (Product prod in _context.Products.Where(x => x.Category.Contains(query)).ToList()) { if (!products.Contains(prod)) products.Add(prod);