User471849597 posted
My controller action with two parameters is never called. Can anyone see what I'm doing wrong?
URL: /api/JobTitle/1/55 (The arguments are 1 and 55.)
ROUTE: (The parameters are oldDescription and newDescription.)
config.Routes.MapHttpRoute(
name: "With2Ids",
routeTemplate: "api/{controller}/{oldDescription}/{newDescription}"
);
CONTROLLER: (The parameters match those in the route.)
[HttpPost]
public HttpResponseMessage UpdateJobTitle(string oldDescription, string newDescription)
{...
CALL FROM VIEW:
$.ajax({
url: updateUrl,
type: 'POST',
success: function (result) {
window.location = "/Views/index.html";
}
});
=========================
I've added a custom route with two parameters with the same names are the controller-action parameters. But it never gets called. Any idea why? Thanks!