You need to refactor your code as below :
(您需要如下重构代码:)
The CustomerController :
(CustomerController:)
public ActionResult Add()
{
return View(new CreateSupplierViewModel());
}
public ActionResult Add(CreateSupplierViewModel model)
{
return View(model);
}
public ActionResult AddNew(CreateSupplierViewModel model)
{
return RedirectToAction("Add", "Supplier", model);
}
Your SupplierController
(您的SupplierController)
public ActionResult Add(CreateSupplierViewModel model)
{
//save the entity
Viewbag.Message ="submit result";
return RedirectToAction("Add", "Customer", model);
}
The Customer/Add.cshtml (show the submit result in view)
(Customer / Add.cshtml(在视图中显示提交结果))
@if( Viewbag.Message != null)
{
<p> @Viewbag.Message </p>
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…