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] 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);