Gareth Suarez
Gareth Suarez

Reputation: 606

Using a list of objects as a parameter for an odata Action

Attempting to setup an action in my odata WebAPI controller, that accepts a List of objects.

however, when I try:

updateSortOrder.Parameter<List<UpdateItem>>("SortOrder"); 

and pass in

{"SortOrder": [{"ItemProperty":"test"}]}

my ODataActionParameters is null.

It works if I change the parameters to accept a single UpdateItem rather than a list, and use:

{"SortOrder": {"ItemProperty":"test"}}

or if I create a wrapper class that contains a list of UpdateItems, but I have been unable to set the parameter itself to a list.

Upvotes: 1

Views: 1486

Answers (1)

RaghuRam Nadiminti
RaghuRam Nadiminti

Reputation: 6793

Use,

updateSortOrder.CollectionParameter<UpdateItem>("SortOrder"); 

instead.

Upvotes: 4

Related Questions