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)); }
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)); }