I have the following API Controller action
[HttpGet]
[Route("assets")]
public async Task<HttpResponseMessage> Get([FromUri]SearchCriteria searchCriteria)
{
}
When i test this with fiddler by accessing the url
the searchCriteria parameter is null but when i try with
http://localhost/assets?param1=1¶m2=2 then searchCriteria has got the instance of the object.
The SearchCriteria class is defined as
public class SearchCriteria
{
public SearchCriteria()
{
Param1 = "";
Param2 = "";
PageIndex = 0;
PageSize = 10;
}
public string Param1 { get; set; }
public string Param2 { get; set; }
public int PageIndex{ get; set; }
public int PageSize { get; set; }
}
What is wrong in my approach? Why the action parameter is null when no querystring is passed?
Thanks