1
我有一个管理餐馆库存的网站。这是我的路线:与MVC中的不同路线冲突
routes.MapRoute(
"Inventory",
"Inventory/{restaurantName}/{restaurantLocationId}/{code}",
new { controller = "Inventory", action = "Index" },
new[] { "MySite.Web.Controllers" }
);
routes.MapRoute( // this route doesn't work
"ListRestaurantInventory",
"Inventory/List/{restaurantLocationId}/{code}",
new { controller = "Inventory", action = "ListRestaurantInventoryItems" },
new[] { "MySite.Web.Controllers" }
);
routes.MapRoute(
"InventoryDetails",
"Inventory/{restaurantName}/{restaurantLocationId}/{code}/Details/{restaurantInventoryItemId}",
new { controller = "Inventory", action = "Details" },
new[] { "MySite.Web.Controllers" }
);
的问题是与ListRestaurantInventory
路线,我得到一个404,如果我尝试导航到/Inventory/List/1/ABC
。我的其他路线工作得很好。
我真的不知道我的路线有什么问题。我是否需要更改路线的顺序或URL中的参数?