是否可以为 a 上的操作定义 URL 段PageController<T>?
以下面的控制器为例,
public class MyPageController : PageController<MyPageData>
{
public ActionResult Index(MyPageData currentPage)
{
return View(currentPage);
}
[HttpPost]
public ActionResult SubmitForm(MyPageData currentPage, FormModel model)
{
// ...
return Redirect("/");
}
}
新的,假设我们MyPageData在 URL 处创建了一个实例/my-page,如果我们渲染一个表单,其动作就是SubmitForm动作,我们将得到一个这样的 URL<form action="/my-page/SubmitForm">
@using(Html.BeginForm("SubmitForm"))
{
...
}
我的问题是,有没有办法定义或控制非索引操作的 URL 段如何呈现,所以表单会像这样呈现<form action="/my-page/submit-form">?