我有一个控制器“ Home”,其中有2个动作,称为“ DeliveryReturn”,还有一个名为“ BasketReturn”的动作,如下所示:
public ActionResult DeliveryReturn(string id)
{
return View();
}
public ActionResult BasketReturn(string id)
{
return View();
}
我尝试这样设置路线。虽然我真的迷路了,但似乎根本没有任何意义。
routes.MapRoute(
name: "Return",
url: "Home/Return/{type}/{id}",
);
更新:
我发现,我可以做这样的事情。但是,这将需要我注册两个路由。我只用一个怎么办?
routes.MapRoute(
name: "DeliveryReturn",
url: "Home/Return/Delivery/{id}",
defaults: new { controller = "Home", action = "DeliveryReturn", id= ""}
);
routes.MapRoute(
name: "BasketReturn",
url: "Home/Return/Basket/{id}",
defaults: new { controller = "Home", action = "BasketReturn", id= ""}
);