I was wondering where does my client calling ajax get the ID to send to the IHttpActionResult Put Verb Action Method? I am accustomed to calling the api with the ID in the url like so /api/Product/id
function productUpdate(product) {
$.ajax({
url: "/api/Product",
type: 'PUT',
contentType:
"application/json;charset=utf-8",
data: JSON.stringify(product),
success: function (product) {
/* productUpdateSuccess(product);*/
},
error: function (request, message, error) {
handleException(request, message, error);
}
});
}
public IHttpActionResult Put(int id, Product product)
{
IHttpActionResult ret = null;
if (Update(product))
{
ret = Ok(product);
}
else
{
ret = NotFound();
}
return ret;
}