I'm brand new to C# and ASP.Net
I am trying to model some endpoints:
/api/sites/
/api/sites/{id}/
/api/sites/{id}/readers/
/api/sites/{id}/readers/{id}/
I already have a SitesController
[Route("api/[controller]")]
[ApiController]
public class SitesController : ControllerBase {
[HttpGet("{id:length(24)}")]
public ActionResult<Site> Get(string id) {}
}
I've tried adding a ReadersController inside the SitesController class
[Route("{id:length(24)}/[controller]}")]
[ApiController]
public class ReadersController {
[HttpGet]
public string Get() => "test";
}
I can't hit the endpoint /api/sites/{id}/readers/ though so I'm not sure I'm doing this right. Is there some way I can do this while still using the [Route] tags?