【发布时间】:2017-07-25 21:52:09
【问题描述】:
我有一个这样的控制器
[Route("api/Foo/MyController/{id}")]
public IHttpActionResult Get(int id)
{
//Code code
foo(id); // Foo accept Int or Null
}
这确实有效,如果调用 api/Foo/MyController/1,但我需要调用 api/Foo/MyController 像“GetAll”这样的参数 id 现在是null 和控制器中的东西全部返回,怎么去那里?
【问题讨论】:
标签: c# asp.net-web-api asp.net-web-api2 asp.net-web-api-routing