Esempio n. 1
0
 public IActionResult AddProduct(Product product)
 {
     if (ModelState.IsValid)
     {
         try
         {
             creatable.Add(product);
             return(RedirectToAction("Index"));
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", ex.Message);
             return(View(product));
         }
     }
     return(View(product));
 }
Esempio n. 2
0
 public IActionResult AddOrder(Order order)
 {
     if (ModelState.IsValid)
     {
         try
         {
             creatable.Add(order);
             return(RedirectToAction("Index"));
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("", ex.Message);
             return(View(order));
         }
     }
     return(View(order));
 }