Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP NET attribute routing array

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?

like image 882
Castaldi Avatar asked Oct 21 '25 03:10

Castaldi


1 Answers

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

enter image description here

enter image description here

like image 123
Lucas Roselli Avatar answered Oct 23 '25 16:10

Lucas Roselli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!