routing path by id in mvc controller code example

Example 1: route attribute controller with parameter asp.net core

[Route("/api/v1/{foo}")]
public class MyController : Controller
{
	public async Task<IActionResult> MyEndpoint(int foo) { }
}

Example 2: route config in mvc

void Application_Start(object sender, EventArgs e)   
{  
    // Code that runs on application startup  
       
    System.Web.Routing.RouteTable.Routes.MapPageRoute("Home","Home/Index","~/Default.aspx");  
  
     System.Web.Routing.RouteTable.Routes.MapPageRoute("About","Home/About-WDI","~/About.aspx");  
  
}