I used the template in Visual Studio 2017 for asp.net core 2.0/react.js but could not manage to post data in the body.
The id from the url is filled correctly, but the string from the body is null.
I'm using IIS Express if it matters.
My code so far:
Server part:
[Produces("application/json")]
[Route("api/Parts")]
public class PartsController : Controller
{
// POST: api/Parts
[HttpPost("{id}")]
public void Post(int id, [FromBody]string value)
{
// breakpoint is hit.
// id is set.
// if I change "string value" to "dynamic value" I get an JObject.
}
}
Client part:
private sendUpdates() {
var payload = { "value": "2"}
fetch('api/Parts/5',
{
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
});
}
The request looks fine in the browser debug:

{property: value}from your client becomes aclass Something { public string Property { get; set } }?