Update SearchController.cs
This commit is contained in:
parent
750653ff72
commit
e40807b6a2
@ -44,9 +44,9 @@ public class SearchController : Controller {
|
||||
List<Product> 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<Product> 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 + " "))
|
||||
|
Loading…
Reference in New Issue
Block a user