public ActionResult Edit(Product product) { if (ModelState.IsValid) { respository.SaveProduct(product); TempData["message"] = string.Format("{0} has been saved", product.Name); return(RedirectToAction(nameof(Index))); } else { return(View(product)); } }
public ActionResult Edit(Product product) { if (ModelState.IsValid) { repository.SaveProduct(product); TempData["message"] = string.Format("{0} 保存成功了", product.Name); return(RedirectToAction("Index", "Admin", new { page = 1 })); } else { return(View(product)); } }