I have an AngularJS misunderstanding. Also, I am not really familiar with WebApi for backend, but I try. I have a modal form wich displays at a click of a button(Submit). I want that when I click 'Submit', to update something in the database. So I thaught of a POST.
AppModule.factory('editResult', function($http)
{
return {
postResult: function(id, res) {
return $http.post('/api/MatchesAdmin/'+id, res);
}
};
});
This service should do the actual posting(I call postResult in Submit function in the controller). I did not set anything in the AppModule.config as I thaught there is no need for it... The WebApi controller(MatchesAdminController) action looks like this:
[HttpPost]
public HttpResponseMessage PostMatch(int id,string result)
{
MatchDTO match= _matchService.GetById(id);
match.Result = result;
_matchService.Update(match);
return Request.CreateResponse(HttpStatusCode.OK);
}
However I played like this in other contexts and it worked. But now, probably because of the modal form, not shure, it says that:
No HTTP resource was found that matches the request URI ...../api/MatchesAdmin/1'
No action was found on the controller 'MatchesAdmin' that matches the request(but there is the action)
Why is that? I also checked WebApi.config and it seemed fine...