I am a new with asp.net web api, in asp.net web api, how i can let it to auto bind more then one parameter for the action, just like below.
public class DemoController : ApiController
{
public class DemoModel
{
public string X { get; set; }
public string Y { get; set; }
public int Z {get; set;}
}
[HttpPost]
public DemoModel GetParameter(string x,string y,int z)
{
return new DemoModel(){X = x, Y=y, Z=z};
}
}
In a html page,i use jquery ajax to post data to the api,and i got a 404 erorr.
I just change the default Route .
Default:
api/{controller}/{id}
Changed:
api/{controller}/{action}/{id}