web api - WebAPI get not converting properly to model binding object -


i"m using webapi mvc4, doing http looks this:

api_version=2&products=[{"id":97497,"name":"ipad"}]&pageno=1 

the signature of action controller maps call is:

[httpget] public string get([fromuri] productrequest request){ ... } 

the problem productrequest object passed action method above contains nulls products, while other values ok.

so seems has trouble converting products=[{"id":97497,"name":"ipad"}] right object type, defined as:

public ienumerable<products> products { get; set;} in productrequest model , products class looks like:

public int id { get; set; } public string name { get; set; } 

as, additional information, when using same call post instead of get, works fine, object converted properly.

so, doing wrong, how can http convert query parameters model passed in?

i think confused between http post , http that's why did product null. have @ what's difference between , post

basically, think use tempdata has pros , cons , depend on context how use it.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -