Tuesday, June 11, 2019

The variable at the verb attribute at a .NET Core controller action could just be a further piece of the route!

This...

[HttpPut("{id}")]

 
 

...or this...

[HttpDelete]
[Route("{id}")]

 
 

...are legit, but you don't have to pass a variable in a forward slash seperated chunk of the route. You can just make the route one chunk longer like so:

[HttpGet("SomethingErOther")]

No comments:

Post a Comment