I'm using Web API (part of ASP.NET MVC 5), and I'm trying to bind querystring values to a Dictionary<int, bool>
.
My Web API method is simply:
[HttpGet]
[Route("api/items")]
public IQueryable<Item> GetItems(Dictionary<int, bool> cf)
{
// ...
}
If I try to invoke this URL:
/api/items?cf[1009]=true&cf[1011]=true&cf[1012]=false&cf[1015]=true
The parameter cf
is always null
.
How can I pass in a dictionary of values via the QueryString to a Web API method?