A long vacation
This commit is contained in:
parent
2d30c4e2b9
commit
1af5b8f702
@ -20,7 +20,7 @@ public class InventoryController : Controller {
|
|||||||
|
|
||||||
[EnableCors("_myAllowSpecificOrigins")]
|
[EnableCors("_myAllowSpecificOrigins")]
|
||||||
[HttpGet(Name = "Inventory")] // Pour faire des calls async par paquet de AMOUNT (5) (pour du loading en scrollant)
|
[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;
|
const int AMOUNT = 5;
|
||||||
|
|
||||||
var ret = _context.Products.AsQueryable();
|
var ret = _context.Products.AsQueryable();
|
||||||
@ -95,6 +95,8 @@ public class InventoryController : Controller {
|
|||||||
if (prod.Id == lastId)
|
if (prod.Id == lastId)
|
||||||
yup = true;
|
yup = true;
|
||||||
}
|
}
|
||||||
|
else if (all.HasValue && all == true)
|
||||||
|
lst = ret.ToList();
|
||||||
else lst = ret.Take(AMOUNT).ToList();
|
else lst = ret.Take(AMOUNT).ToList();
|
||||||
|
|
||||||
return lst;
|
return lst;
|
||||||
|
@ -31,8 +31,12 @@ public class SearchController : Controller {
|
|||||||
if (preview.HasValue && preview == true)
|
if (preview.HasValue && preview == true)
|
||||||
products = _context.Products.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToList();
|
products = _context.Products.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToList();
|
||||||
else {
|
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()) {
|
foreach (Product prod in _context.Products.Where(x => x.Category.Contains(query)).ToList()) {
|
||||||
if (!products.Contains(prod))
|
if (!products.Contains(prod))
|
||||||
products.Add(prod);
|
products.Add(prod);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user