I am working on an ASP.NET MVC app. In my app, I have a controller that looks like this:
[RoutePrefix("account/orders")]
public partial class AccountOrdersController : Controller
{
[Route]
public virtual ActionResult Index()
{
return View();
}
[Route("add")]
[Route("~/dashboard/orders/{orderId}/item")]
public virtual ActionResult Add(string orderId)
{
return View();
}
}
In the Index view, I am referencing the Add action like this:
var url = '@Url.Action("Add", "AccountOrdersController", new RouteValueDictionary(new { orderId = "xyz" }))';
When the view gets rendered, the above becomes:
var url = '/account/orders/add?orderId=xyz';
How do I get the above to be rendered as:
var url = '/account/orders/xyz/item';
I'm trying to create a URL that is a complete path instead of just appending query string parameters.