我的全局文件中有两条路线。 propertydetails的路由工作正常,但它不适用于预订我使用的链接是。知道为什么它不起作用
@Html.ActionLinkWithSpan("BookNow", "Create", "Booking", new {item.ProductId,item.ProductName},"gradient-button")
@Html.ActionLinkWithSpan("MoreDetails", "Index", "PropertyDetails", new {item.ProductId,item.ProductName},"")
routes.MapRoute(
"Booking",
"Book/{ProductId}/{ProductName}",
new { controller = "BookingController", action = "Create", ProductName = UrlParameter.Optional }
);
routes.MapRoute(
"PropertyDetails",
"Details/{ProductId}/{ProductName}",
new { controller = "PropertyDetails", action = "Index", ProductName = UrlParameter.Optional }
);
答案 0 :(得分:0)
好吧,我明白了......刚刚更换了
routes.MapRoute(
name: "Booking",
url: "{controller}/{ProductId}/{ProductName}",
defaults: new { controller = "BookingController", action = "Create", ProductId = UrlParameter.Optional }
);