Пример #1
0
 public Microsoft.AspNetCore.Mvc.IActionResult Delete(int productId)
 {
     BilliardStore.Models.Product deletedProduct = repository.DeleteProduct(productId);
     if (deletedProduct != null)
     {
         TempData["message"] = $"{deletedProduct.Name} was deleted";
     }
     return(RedirectToAction("Index"));
 }
Пример #2
0
 public Microsoft.AspNetCore.Mvc.IActionResult Edit(BilliardStore.Models.Product product)
 {
     if (ModelState.IsValid)
     {
         repository.SaveProduct(product);
         TempData["message"] = $"{product.Name} has been saved";
         return(RedirectToAction("Index"));
     }
     else
     {
         // there is something wrong with the data values
         return(View(product));
     }
 }