diff --git a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs index 4eafcbb..108a13d 100644 --- a/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs +++ b/GrossesMitaines/GrossesMitainesAPI/Controllers/SearchController.cs @@ -44,9 +44,9 @@ public class SearchController : Controller { List title = new(), desc = new(), cat = new(); query = query.ToLower(); foreach (Product prod in _context.Products.ToArray()) { - string sTitle = prod.Title.Replace(",", " ").ToLower(), - sCat = prod.Category.ToLower(), - sDesc = prod.Description.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 + " ")) @@ -90,9 +90,9 @@ public class SearchController : Controller { List title = new(), desc = new(), cat = new(); query = query.ToLower(); foreach (Product prod in _searchCache) { - string sTitle = prod.Title.Replace(",", " ").ToLower(), - sCat = prod.Category.ToLower(), - sDesc = prod.Description.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 + " "))