react-version #1

Merged
memartel_loc merged 290 commits from react-version into main 2023-11-04 09:48:15 -04:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit dc71afe986 - Show all commits

View File

@ -22,13 +22,14 @@ public class SearchController : Controller {
[EnableCors("_myAllowSpecificOrigins")]
[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());
@ -39,7 +40,5 @@ public class SearchController : Controller {
}
return products;
}
}

View File

@ -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": [