In my WebAPI
I have model
public class ListRequest
{
public int Skip { get; set; } = 0;
public int Take { get; set; } = 30;
}
My action is
[HttpGet]
[Route("api/users")]
public IHttpActionResult Get([FromUri] ListRequest request) {
...
}
I need to have possibility to not pass any query parameters, then default values should be used. But, when I go to http://localhost:44514/api/users
the request
is null. If I remove [Route("api/users")]
then request
is not null and has default values for parameters.
How can I reach that behavior with Route attribute?