public ActionResult Save(Product products) { if (!ModelState.IsValid) { return(View("CreateProduct")); } try { if (products == null) { return(View("CreateProduct")); } if (products.Id == 0) { _productApplication.Register(products); } else { _productApplication.Update(products); } return(RedirectToAction("Index")); } catch { return(View("CreateProduct")); } }
public ActionResult Create(Product product) { if (ModelState.IsValid) { _productApplication.Register(product); return(RedirectToAction("Index")); } return(View(product)); }