Update InventoryController.cs
This commit is contained in:
		| @@ -78,14 +78,23 @@ public class InventoryController : Controller { | ||||
|                 break; | ||||
|             default: break; | ||||
|         } | ||||
|         if (order is not null && order.Contains("Desc")) { | ||||
|             if (!lastId.HasValue) | ||||
|                 lastId = _context.Products.Max(x => x.Id) + 1; | ||||
|         } else  | ||||
|             if (!lastId.HasValue) | ||||
|                 lastId = _context.Products.Min(x => x.Id) - 1; | ||||
|  | ||||
|         List<Product> lst = ret.ToList(); | ||||
|  | ||||
|         if (lastId.HasValue) | ||||
|             foreach (Product prod in new List<Product>(lst)) { | ||||
|                 lst.Remove(prod); | ||||
|                 if (prod.Id == lastId) | ||||
|                     break; | ||||
|             } | ||||
|         //if (order is not null && order.Contains("Desc")) { | ||||
|         //    if (!lastId.HasValue) | ||||
|         //        lastId = _context.Products.Max(x => x.Id) + 1; | ||||
|         //} else  | ||||
|         //    if (!lastId.HasValue) | ||||
|         //        lastId = _context.Products.Min(x => x.Id) - 1; | ||||
|           | ||||
|         return ret.Where(x => x.Id > lastId).Take(AMOUNT).ToList(); | ||||
|         return lst.Take(AMOUNT); | ||||
|     } | ||||
|  | ||||
|     // Inventory/Delete => Décrémenter un produit. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user