From 55f4dc4f534e41d33ba08fe97d30f7e2f2887db0 Mon Sep 17 00:00:00 2001 From: Yishai Galatzer Date: Thu, 8 May 2014 15:45:10 -0700 Subject: [PATCH] Remove the area routes Add id? to the routes --- .gitignore | 1 + src/Microsoft.AspNet.Mvc/BuilderExtensions.cs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index aba9c594d7..216e8d9c58 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ [Bb]in/ TestResults/ .nuget/ +*.sln.ide/ _ReSharper.*/ packages/ artifacts/ diff --git a/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs b/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs index f7aaa7b124..c67500b978 100644 --- a/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs +++ b/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs @@ -27,10 +27,11 @@ namespace Microsoft.AspNet.Builder { return app.UseMvc(routes => { - routes.MapRoute(null, "{area}/{controller}/{action}", new { controller = "Home", action = "Index" }); - routes.MapRoute(null, "{area}/{controller}", new { controller = "Home" }); - routes.MapRoute(null, "{controller}/{action}", new { controller = "Home", action = "Index" }); - routes.MapRoute(null, "{controller}", new { controller = "Home" }); + // Action style actions + routes.MapRoute(null, "{controller}/{action}/{id?}", new { controller = "Home" , action = "Index" }); + + // Rest style actions + routes.MapRoute(null, "{controller}/{id?}"); }); } @@ -41,7 +42,6 @@ namespace Microsoft.AspNet.Builder DefaultHandler = new MvcRouteHandler() }; - // REVIEW: Consider adding UseMvc() that automagically adds the default MVC route configureRoutes(routes); return app.UseRouter(routes);