Chris Marisic
Chris Marisic

Reputation: 33128

AttributeRouting is it possible to capture / inside of a parameter?

First let me be clear I am talking about the independent project of AttributeRouting http://attributerouting.net/ and not the built-in attribute routing.

Take this slightly modified version of their example code:

public class SampleController : Controller
{   
    [GET("Sample")]
    public ActionResult Index() { /* ... */ }
    [POST("Sample")]
    public ActionResult Create() { /* ... */ }
    [PUT("Sample/{id}")]
    public ActionResult Update(string id) { /* ... */ }
}

Suppose that for Update I wanted to have the request PUT Sample/Cheese/Swiss is there any way to inform AttributeRouting that the id parameter should capture "Cheese/Swiss"?

Upvotes: 0

Views: 54

Answers (1)

Kijana Woodard
Kijana Woodard

Reputation: 520

Wouldn't [PUT("Sample/{*id}")] work? The asterisk means "take the rest".

Upvotes: 1

Related Questions