I am able to send a raw json object from my angular controller which is deserialized to a known type at my web api method. This is great but I now need to be able to send other parameters in the same request, these could be json objects or simple types like string or int.
I've seen articles such as this which describe exactly my problem but they are sending their request from codebehind rather than client side.
I tried to construct a json array and send this in but I get the following message : 'Cannot create an abstract class'.
Controller Code (adapted)
var request = {
params:[]
};
request.params.push(jsonObjectA);
request.params.push({"someString" : "ABCDEF"});
$http({
method: 'POST',
url: targetUri,
data: request
})
Web API Method Signature
public JsonResult TestMethod(JArray request)
Does this approach sound sensible? I really want to avoid having to create dto objects for every request if I can.