public class OrderController : ApiController
{
[HttpGet]
public IHttpActionResult GetAll()
{
return Ok<string>("Success");
}
[HttpGet]
public IHttpActionResult GetById(int id)
{
return Ok<string>("Success" + id );
}
[HttpPost]
public HttpResponseMessage PostData(int id)
{
return Request.CreateResponse();
}
[HttpPost]
public HttpResponseMessage SavaData(ORDER order)
{
return Request.CreateResponse();
}
[HttpPut]
public IHttpActionResult Put(int id)
{
return Ok();
}
[HttpDelete]
public IHttpActionResult DeleteById(int id)
{
return Ok();
}
}
匹配action的结果
| url | http方法 | 参数 | 结果 |
|---|---|---|---|
| http://www.easck.com/td> | none | 匹配GetAll方法 | |
| http://www.easck.com/td> | id | 匹配GetById方法 | |
| http://www.easck.com/td> | order | 匹配SavaData方法 | |
| http://www.easck.com/td> | id | 匹配Put方法 | |
| http://www.easck.com/td> | id | 匹配DeleteById方法 |










