I\'ve got a new API that I\'m building with ASP.NET Core, and I can\'t get any data POST\'ed to an endpoint.
Here\'s what the endpoint looks like:
Another reason for the model binding to fail (always null) is if the data type for a property doesn't match. For example here is a simple model:
public class MyService {
public string JobId { get; set; }
public int ServiceType {get; set;}
}
And here is some json that doesn't match:
{"JobId":1, "ServiceType":1}
I got caught with this when I was retrieving the JobId using jquery's .data function, it was automatically converting it to an int. Fixed it by using .attr function instead.