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中的參數?