From 144ff9478f662e4c2796665e6c5ec38548c91ebc Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Tue, 18 Oct 2022 11:28:22 -0700 Subject: [PATCH] Cleanup on aisle Search --- .../GrossesMitainesAPI/Controllers/SearchController.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs index d6629d8..3292fcb 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs @@ -35,15 +35,12 @@ public class SearchController : Controller { try { // Pour faire une liste priorisée. if (preview.HasValue && preview == true) - //products = _context.Products.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToList(); products = _searchCache.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToList(); - else { if (deep.HasValue && deep == true) { List title = new(), desc = new(), cat = new(); query = query.ToLower(); - // foreach (Product prod in _context.Products.ToList()) { foreach (Product prod in _searchCache) { string sTitle = prod.Title.Replace(".", " ").Replace(",", " ").ToLower(), sCat = prod.Category.Replace(".", " ").Replace(",", " ").ToLower(), @@ -61,16 +58,11 @@ public class SearchController : Controller { products.AddRange(title); products.AddRange(desc); products.AddRange(cat); - } else { - // products = _context.Products.Where(x => x.Title.Contains(query)).ToList(); products = _searchCache.Where(x => x.Title.Contains(query)).ToList(); - - // foreach (Product prod in _context.Products.Where(x => x.Description.Contains(query)).ToList()) foreach (Product prod in _searchCache.Where(x => x.Description.Contains(query)).ToList()) if (!products.Contains(prod)) products.Add(prod); - // foreach (Product prod in _context.Products.Where(x => x.Category.Contains(query)).ToList()) foreach (Product prod in _searchCache.Where(x => x.Category.Contains(query)).ToList()) if (!products.Contains(prod)) products.Add(prod);