Update SearchController.cs

This commit is contained in:
MarcEricMartel 2022-10-25 10:17:54 -07:00
parent 80375cda05
commit 902d7a15fd

View File

@ -107,10 +107,10 @@ public class SearchController : Controller {
products.AddRange(cat);
} else {
products = _searchCache.Where(x => x.Title.Contains(query)).ToList();
foreach (Product prod in _searchCache.Where(x => x.Description.Contains(query)).ToList())
foreach (Product prod in _searchCache.Where(x => x.Description.Contains(query)).ToArray())
if (!products.Contains(prod))
products.Add(prod);
foreach (Product prod in _searchCache.Where(x => x.Category.Contains(query)).ToList())
foreach (Product prod in _searchCache.Where(x => x.Category.Contains(query)).ToArray())
if (!products.Contains(prod))
products.Add(prod);
}