This is probably something very simple, but Googling feebly isn't getting me anywhere.
In the web application we're building, we've got Projects, and Templates. Templates are really just Projects, with the IsTemplate flag set to true. So naturally, we've got a single Project controller that handles (or will handle) both cases.
We've got one route to a New
action method on the controller:
Project/New
That's just the standard {controller}/{action}/{id}
route handling that one. Now, the New
action method has an IsTemplate
parameter. I'd like to have one route where that's passed in as false (the one above), and a second one where it's passed in as true:
Templates/New
What's the proper way to mask an arbitrary action method parameter with varying URLs like that? I tried the following, but it just confused the routing (Html.ActionLink
ends up pointing at Templates/New
):
routes.MapRoute(
null,
"Template/New",
new { controller = "Project", action = "New", IsTemplate = true }
);
Or would it be a lot simpler for me to just split this into two action methods, and have those call a single private controller method with a hard-coded parameter value?