Update SearchController.cs

This commit is contained in:
MarcEricMartel 2022-10-25 09:06:06 -07:00
parent 6371d350fa
commit 9652403faf

View File

@ -6,6 +6,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using GrossesMitainesAPI.Services; using GrossesMitainesAPI.Services;
using System.Collections.Immutable;
namespace GrossesMitainesAPI.Controllers; namespace GrossesMitainesAPI.Controllers;
@ -21,7 +22,6 @@ public class SearchController : Controller {
_logger = logger; _logger = logger;
_context = context; _context = context;
_cache = cache; _cache = cache;
if (_cache.isOk()) if (_cache.isOk())
_searchCache = _cache.GetCacheCopy(); _searchCache = _cache.GetCacheCopy();
} }
@ -43,7 +43,6 @@ public class SearchController : Controller {
if (deep.HasValue && deep == true) { if (deep.HasValue && deep == true) {
List<Product> title = new(), desc = new(), cat = new(); List<Product> title = new(), desc = new(), cat = new();
query = query.ToLower(); query = query.ToLower();
foreach (Product prod in _context.Products.ToList()) { foreach (Product prod in _context.Products.ToList()) {
string sTitle = prod.Title.Replace(",", " ").ToLower(), string sTitle = prod.Title.Replace(",", " ").ToLower(),
sCat = prod.Category.ToLower(), sCat = prod.Category.ToLower(),