Exemplo n.º 1
0
 public IActionResult Edit(Product product)
 {
     ViewBag.Categories = categories;
     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));
     }
 }