Skip to content Skip to sidebar Skip to footer

How To Post An Object To WebAPI

I'm trying to figure out how to post an object from my form to a web api service. Within my controller I defined a model that I wanted to add input values to. $scope.Label; withi

Solution 1:

It seems like you may be doing an extra step. You don't need to encode in json then pass in in json

return $http.post('reportLibrary/createlabel/', { LabelId: 101, LabelName: 'myname' }, {

then

 public DTOs.ReportLabel CreateLabel([FromBody]ReportLabel reportLabel)

Take a look at the network values going by and you should see in debug tools or fiddler the actual posted values (form values).


Post a Comment for "How To Post An Object To WebAPI"