I have the following class:
public class SomeArg
{
public int name { get; set; }
}
the POST request sends that data
var requestData = {};
requestData.items = [{ name: 1 }, { name: 2 }];
requestData.logic = "and";
$http.post('SomeAction/',
JSON.stringify(requestData),
{ headers: { 'Content-Type': 'application/json' } }
)
.success(function (data, status, headers, config) {
}).
error(function (data, status, headers, config) {
});
and the WebApi controller's action
[HttPost]
public HttpResponseMessage SomeAction(string logic = null,
[FromUri]
SomeArg[] items = null) { ... }
I can see that all of the arguments are null. Why ?