On StackOverflow there are Question about Changing the parameter name in Web Api for model binding --> HERE
As I currently works with such type of binding using FromURI
I've also tried to make URI shorter using FromURI(Name='...')
.
But I have one question (can't find answer in Google) - Is it possible to set Name
parameter for Model?
For example :
Web API GET Method :
[HttpGet] public async Task<List<string>> Get([FromUri]SearchModel searchObj)
SearchModel Model
public class SearchModel { public string UserName { get; set; } public DateTime? StartDate { get; set; } public DateTime? EndDate { get; set; } public DayTypes? Type { get; set; } }
So Is it possible to send request to server with such URI params that can init Model:
?u=test&s=2016-01-01&e=2016-04-04&t=DayOff
Where
u
isUserName
s
isStartDate
e
isEndDate
t
isType