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.
How do I do that?
Thanks in advance Paul
CodePudding user response:
[HttpGet]
[Route("data/{id}")]
public IActionResult Get([FromRoute(Name="id")] int id)
{
...
}