예제 #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));
 }
예제 #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));
 }