I am new to asp.core, so I try to make the correct route to {id}/visits
My code is:
[Produces("application/json")]
[Route("/Users")]
public class UserController
{
[HttpGet]
[Route("{id}/visits")]
public async Task<IActionResult> GetUser([FromRoute] long id)
{
throw new NotImplementedException()
}
}
But, with the route, the {id}generated method is the same:
[HttpGet("{id}")]
public async Task<IActionResult> GetUser([FromRoute] long id)
{
return Ok(user);
}
How to make a /Users/5/visitsnethod route ?
What options GetUsershould I add?
source
share