1
I have a question regarding the use of the Asp.net web api with Angularjs that follows below.
I have 2 methods in my controller class (Itenscontroller.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 Itenscontroller:
public void Put(int osID, [FromBody]Item value)
{
}
and
[ActionName("UpdateItemFees")]
[HttpPost]
public void UpdateItemFees(int osID, [FromBody]Item value)
{
}
The mistakes are:
No HTTP Resource was found that Matches the request URI
'http://local/api/Itens/Put/3443'.
and
No HTTP Resource was found that Matches the request URI
'http://local/api/Itens/UpdateItemFees/3443'.
Wrong to rename method parameter (from "id" to "osID")?
I have other methods on the page, like GET that are working perfectly, including parameters with custom names (this I find strange).
Thanks in advance.