I have a question on using the asp.net web api with angularJS that follows below.
I have 2 methods in my controller class (ItemsController.cs):
public void Put(int id, [FromBody]Item value)
{
}
and
[ActionName("UpdateItemFees")]
[HttpPost]
public void UpdateItemFees(int id, [FromBody]Item value)
{
}
My call on the client is:
$http.put('/api/Itens/Put/' + $scope.osID, item)
$http.post('/api/Itens/UpdateItemFees/' + $scope.osID, item)
This works without problems. The problem is when I change the name of a parameter in these methods, then the system no longer calls the method in the Controls Items:
public void Put(int osID, [FromBody]Item value)
{
}
and
[ActionName("UpdateItemFees")]
[HttpPost]
public void UpdateItemFees(int osID, [FromBody]Item value)
{
}
The errors are:
'http://local/api/Itens/Put/3443'.
and
'http://local/api/Itens/UpdateItemFees/3443'.
What is wrong with changing the method parameter name (from "id" to "osID")?
I have other methods on the page, like GET that are working perfectly, even with parameters with custom names (this I find strange).
Thank you in advance.