0

I want to create a controller route to get details for an object with given id.

I know how to create a route like /data?id=15, but I would prefer the route to be /data/15. enter image description here

How do I do that?

Thanks in advance Paul

1 Answer 1

1
[HttpGet]
[Route("data/{id}")]
public IActionResult Get([FromRoute(Name="id")] int id)
{
...
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you :) Can you tell me what that type of route is called?