I added these routes to RouteConfig.cs
routes.MapRoute(
name: "NewPositiveRelease",
url: "dispatch/{poNumber}/{article}",
defaults: new { controller = "PositiveReleaseItem", action = "Create"});
routes.MapRoute(
name: "Dispatch",
url: "dispatch",
defaults: new { Controller = "Dispatch", action = "Index"});
In the hopes that I could go to this url
locahost:3000/dispatch/4529707272/171112
To execute the Create
action in PositiveReleaseItemController
. However, when I navigate to that url, I am seeing the error:
A public action method '4529707272' was not found on controller 'MVCQCPage.Controllers.DispatchController'.
Can someone please help me understand why this doesn't work?
Here is the controller:
using SharedLibrary.Models;
using System.Web.Mvc;
namespace MVCQCPage.Controllers
{
public class PositiveReleaseItemController : Controller
{
// GET: PositiveReleaseItem
public ActionResult Index()
{
return View();
}
public ActionResult Create(string poNumber, string article)
{
return View();
}
public ActionResult Insert(PositiveReleaseItem item)
{
return View();
}
}
}
I tried changing the order of the given routes, but with the same outcome. Please let me know if I can add any details which might help.
Thanks