4

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
  • Correct syntax for an array is int[] ids, is that what you meant? And routing via array I've always seen done via string param and the parsing the values from the string into an array, although often it's a problem of the wrong setup. What are you trying to achieve here? Commented Sep 22, 2015 at 15:32

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.