Esempio n. 1
0
 public async Task <IActionResult> Update([Bind("ID, ProductID, ProductName, CustomerEmail, Quantity, ImgUrl, Description, UnitPrice")] BasketItem basketItem)
 {
     if (ModelState.IsValid)
     {
         try
         {
             if (basketItem.Quantity == 0)
             {
                 await _basketRepo.DeleteProductFromBasket(basketItem);
             }
             else
             {
                 await _basketRepo.UpdateBasket(User.Identity.Name, basketItem);
             }
         }
         catch
         {
             throw;
         }
     }
     return(RedirectToAction(nameof(MyBasket)));
 }