【发布时间】:2017-09-01 02:54:31
【问题描述】:
我的结帐页面有多种付款方式。每个方法都有自己的局部视图,其中包含自己的模型。我试图在每种不同的方法上保持 url 相同,所以如果出现错误,url 不会改变。有没有办法做到这一点?感谢您的帮助,我已经考虑了一段时间了。
结帐模型
public class CheckoutForm
{
public Method1Form method1Form { get; set; }
public Method2Form method2Form { get; set; }
public Method3Form method3Form { get; set; }
}
结帐控制器
[HttpGet]
[Route("checkout/{guid}")]
public IActionResult Checkout([FromRoute] String guid)
{
....
return View(model);
}
[HttpPost]
[Route("checkout/{guid}")]
public IActionResult Checkout([FromRoute] String guid, Method1 model)
{
....
//Some Error Condition Triggered
return View(checkoutmodel);
}
[HttpPost]
[Route("checkout/{guid}")]
public IActionResult Checkout([FromRoute] String guid, Method2 model)
{
....
//Some Error Condition Triggered
return View(checkoutmodel);
}
[HttpPost]
[Route("checkout/{guid}")]
public IActionResult Checkout([FromRoute] String guid, Method3 model)
{
....
//Some Error Condition Triggered
return View(checkoutmodel);
}
【问题讨论】:
标签: asp.net-core