public ActionResult Edit(ProductViewData productViewData) { var product = productBuilder.ProductFromProductViewData(productViewData, ModelState, Request); if (ModelState.IsValid) { return(this.RedirectToAction(x => x.Edit(product.Id))); } return(View("Edit", productViewData.WithErrorMessage("There were errors, please correct them and resubmit."))); }
public ActionResult New(ProductViewData productViewData) { var product = productBuilder.ProductFromProductViewData(productViewData, ModelState, Request); if (ModelState.IsValid) { productRepository.SaveOrUpdate(product); uow.Commit(); //Need explicit commit in order to get the product id. return(this.RedirectToAction(x => x.Edit(product.Id))); } return(View("Edit", productViewData.WithErrorMessage("There were errors, please correct them and resubmit."))); }