Is there any way to configure attribute routing with fixed parameter in .net core
[Route("TermsOfUse")] // ex: i need push default routing with id = 5
public async Task<IActionResult> Details(int id) { }
I found a way to use routes.MapRoute
routes.MapRoute(null, "TermsOfUse", new { controller = "Article", action = "Details", id=5 })
How to use attribute routing?
You can do as follow:
[Route("TermsOfUse/{id=5}")]
public async Task<IActionResult> Details(int id) { }
If no value for id
is supplied then it will be 5.