I am using backbone.js in my mvc application and I have a scenario where I have to pass an array to my Post method in Rest API. I am trying to send an array of models and then calling this.collection.create(model)
. I am trying to call the Post method as
var myArrayofModels = JSON.stringify(e.models);
this.collection.create(myArrayofModels );
Here e.models
is an array of models which I convert to json and call Post method and I want to receive array of models on Post method like this
public HttpResponseMessage Post(InsuranceAddressViewModel[] model)
{
return null;
}
But I am getting null array in Post method. Is my method of converting array of models to json is fine or will have to do something else. I have tried couple of solutions but couldn't get idea.