lolfreud
This commit is contained in:
parent
84e6bb9bc3
commit
33a451a43f
@ -19,13 +19,14 @@ public class SearchController : Controller {
|
||||
|
||||
[HttpPost(Name = "Search")]
|
||||
public IEnumerable<Product> Post(string query, bool? preview) {
|
||||
const int PREVIEW = 3;
|
||||
HashSet<Product> products = new();
|
||||
|
||||
query = query.Trim();
|
||||
|
||||
try { // Pour faire une liste priorisée.
|
||||
if (preview.HasValue && preview == true)
|
||||
products = _context.Products.Where(x => x.Title.Contains(query)).Take(3).ToHashSet();
|
||||
products = _context.Products.Where(x => x.Title.Contains(query)).Take(PREVIEW).ToHashSet();
|
||||
else {
|
||||
products.Concat(_context.Products.Where(x => x.Title.Contains(query)).ToHashSet());
|
||||
products.Concat(_context.Products.Where(x => x.Category.Contains(query)).ToHashSet());
|
||||
@ -36,7 +37,5 @@ public class SearchController : Controller {
|
||||
}
|
||||
return products;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,8 @@
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
"eject": "react-scripts eject",
|
||||
"startsrv": "cd ../GrossesMitainesAPI/ & dotnet run"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
Loading…
Reference in New Issue
Block a user