In my startup.cs class I have:
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
My controller currently looks like so:
[Microsoft.AspNetCore.Components.Route("api/my-test")]
public class MyTestController : ControllerBase
{
[HttpGet]
[Route("{confirmationCode}")]
public async Task<IActionResult> Get(string confirmationCode)
{
return Ok($"The confirmation code is: {confirmationCode}");
}
}
How can I call the Get action on my MyTestController and get access to the confirmation code that was passed in as part of the URL from a route URL that looks like this: /api/my-test/abc123