ASP NET attribute routing array

我与影子孤独终老i 提交于 2019-12-11 00:35:26

问题


So I am using attribute routing for my controller like this:

    [Route("last/{id:int}")]
    public IHttpActionResult GetUpdateLast([FromUri] int id) { 
        return Ok();
    }

Now I want to convert it to accept an array of integers, in the controller parameter I just switch to [FromUri] int id[] with no problems, however, how do I switch the route attribute [Route("last/{id:int}")] to make it accept an array of integers?


回答1:


Your were almoust there, there is no way of doing what you want using the route, so use as a query string :



来源:https://stackoverflow.com/questions/32719274/asp-net-attribute-routing-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!