How to set routes in asp.net core application
<p>i have asp.net core application. In my application the default route is set to <code>Home/Index/id</code></p>

<p>I have one more controller name <code>Document</code></p>

<pre><code> public class DocumentController : Controller
 {
        public IActionResult Index(int? id)
        {          
           // id may be null. Do something with id here 
            return View();          
        }

        public IActionResult Detail(int id)
        {
          return View();
        }
 }
</code></pre>

<p>in startp.cs i have setup my route as below</p>

<pre><code>app.UseMvc(routes =&gt;
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "document",
                    template: "Document/{action}/{id?}",
                    defaults: new { controller = "Document", action = "Index" });

            });
</code></pre>

<p>i can browse the document view as <code>http://localhost:40004/Document</code> or <code>http://localhost:40004/Document?id=1234</code>  </p>

<p>however i want the following routes to be valid<br>
 <code>http://localhost:40004/Document/1234</code><br>
 <code>http://localhost:40004/Document?id=1234</code><br>
 <code>http://localhost:40004/Document/Details/1234</code><br>
 <code>http://localhost:40004/Document/Details?id=1234</code>  </p>

<p>What should be my route configuration in startup.cs?</p>