запрос с передачей данных json, на angularjs http
$scope.editTextSave = function (bookid, partbookId, textOfBookId) {
$http({
url: '/Text/EditSave/' + bookid + '/' + partbookId + '/' + textOfBookId,
method: 'POST',
data: JSON.stringify({
TextId: textOfBookId,
TextBook:$scope.htmlcontent,
BookId: bookid,
PartId: partbookId
}),
headers: { 'Content-Type': 'application/json' },
transformRequest: false
}).success(function (data) {
});
};
web api c# asp.net, без [FromBody] приходит null
[HttpPost]
[Route("Text/EditSave/{booklink?}/{partbookId?}/{textOfBookId?}")]
public async Task<bool> EditSave([FromBody]TextOfBookViewModel model)
{
return true;
}