A long vacation

This commit is contained in:
MarcEricMartel 2022-10-18 10:25:08 -07:00
parent 2d30c4e2b9
commit 1af5b8f702
2 changed files with 9 additions and 3 deletions

View File

@ -20,7 +20,7 @@ public class InventoryController : Controller {
[EnableCors("_myAllowSpecificOrigins")]
[HttpGet(Name = "Inventory")] // Pour faire des calls async par paquet de AMOUNT (5) (pour du loading en scrollant)
public IEnumerable<Product> Get(int? lastId, string? order, string? filterPrice, string? filterState) {
public IEnumerable<Product> Get(int? lastId, string? order, string? filterPrice, string? filterState, bool? all) {
const int AMOUNT = 5;
var ret = _context.Products.AsQueryable();
@ -95,6 +95,8 @@ public class InventoryController : Controller {
if (prod.Id == lastId)
yup = true;
}
else if (all.HasValue && all == true)
lst = ret.ToList();
else lst = ret.Take(AMOUNT).ToList();
return lst;

View File

@ -31,7 +31,11 @@ public class SearchController : Controller {
if (preview.HasValue && preview == true)
products = _context.Products.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToList();
else {
products = _context.Products.Where(x => x.Title.Contains(query)).ToList();
products = _context.Products.Where(x => x.Title.Replace(".", " ")
.Replace(",", " ")
.ToUpper()
.Contains(" " + query.ToUpper() + " "))
.ToList();
foreach (Product prod in _context.Products.Where(x => x.Category.Contains(query)).ToList()) {
if (!products.Contains(prod))