我是使用aspnet web api进行属性路由的新手。
public class UsersController : ApiController
{
[GET("users/me/brands/{id}")]
public IEnumerable<Brand> GetBrands(long id)
{
return _repository.FindByUser(id);
}
}
但我无法达成此举动。我尝试过很多方法:
http://example.com/api/users/brands/4
http://example.com/api/users/brands?id=4
http://example.com/users/brands?id=4
http://example.com/users/brands/4
PS:我也映射为[GET("api/users/me/brands/{id}")]
我缺少什么?