react-version #1

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

View File

@ -62,10 +62,10 @@ public class InventoryController : Controller {
switch (order) {
case "Price":
ret = ret.OrderBy(x => x.Status == Product.States.Promotion? x.PromoPrice: x.Price);
ret = ret.OrderBy(x => x.Status == Product.States.Promotion || x.Status == Product.States.Clearance? x.PromoPrice: x.Price);
break;
case "PriceDesc":
ret = ret.OrderByDescending(x => x.Status == Product.States.Promotion ? x.PromoPrice : x.Price);
ret = ret.OrderByDescending(x => x.Status == Product.States.Promotion || x.Status == Product.States.Clearance ? x.PromoPrice : x.Price);
break;
case "Title":
ret = ret.OrderBy(x => x.Title);

View File

@ -54,8 +54,8 @@ public class ProductController : ControllerBase {
}
[EnableCors("_myAllowSpecificOrigins")]
[HttpPut(Name = "Product")]
public ActionResult<Product> Put(Product prod) {
[HttpPatch(Name = "Product")]
public ActionResult<Product> Patch(Product prod) {
try {
_context.Products.Update(prod);
_context.SaveChanges();

View File

@ -42,16 +42,16 @@ public class SearchController : Controller {
query = query.ToLower();
foreach (Product prod in _searchCache) {
string sTitle = prod.Title.Replace(".", " ").Replace(",", " ").ToLower(),
sCat = prod.Category.Replace(".", " ").Replace(",", " ").ToLower(),
string sTitle = prod.Title.Replace(",", " ").ToLower(),
sCat = prod.Category.ToLower(),
sDesc = prod.Description.Replace(".", " ").Replace(",", " ").ToLower();
if (sTitle.StartsWith(query))
products.Add(prod);
else if (sTitle.Contains(" " + query + " "))
title.Add(prod);
else if (sDesc.Contains(" " + query + " "))
else if (sDesc.StartsWith(query) || sDesc.Contains(" " + query + " "))
desc.Add(prod);
else if (sCat.Contains(" " + query + " "))
else if (sCat.Contains(query))
cat.Add(prod);
}
products.AddRange(title);

View File

@ -33,8 +33,10 @@ const Inventaire = () => {
const newMorceau = await response.json();
console.log(newMorceau);
if (response.ok)
if (response.ok) {
setMorceaux([...morceaux, { ...newMorceau }]);
console.log("Ajout de l'item avec succès: \r\n" + newMorceau);
}
else
console.log("Erreur de creation " + morceau);
};