diff --git a/samples/MvcSample.Web/Areas/Travel/Controllers/Flight.cs b/samples/MvcSample.Web/Areas/Travel/Controllers/Flight.cs new file mode 100644 index 0000000000..38e5c7af80 --- /dev/null +++ b/samples/MvcSample.Web/Areas/Travel/Controllers/Flight.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNet.Mvc; + +namespace MvcSample.Web +{ + [Area("Travel")] + public class Flight : Controller + { + public IActionResult Fly() + { + return View(); + } + } +} diff --git a/samples/MvcSample.Web/Areas/Travel/Views/Flight/Fly.cshtml b/samples/MvcSample.Web/Areas/Travel/Views/Flight/Fly.cshtml new file mode 100644 index 0000000000..ed15ba423b --- /dev/null +++ b/samples/MvcSample.Web/Areas/Travel/Views/Flight/Fly.cshtml @@ -0,0 +1,33 @@ +@using MvcSample.Web.Models +@model User +@{ + Layout = "/Views/Shared/_Layout.cshtml"; + ViewBag.Title = "This is the FLY action"; +} + +
+

ASP.NET

+

ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

+

Learn more »

+
+
+
+

Getting started

+

+ ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that + enables a clean separation of concerns and gives you full control over markup + for enjoyable, agile development. +

+

Learn more »

+
+
+

Get more libraries

+

NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

+

Learn more »

+
+
+

Web Hosting

+

You can easily find a web hosting company that offers the right mix of features and price for your applications.

+

Learn more »

+
+
diff --git a/samples/MvcSample.Web/Startup.cs b/samples/MvcSample.Web/Startup.cs index 522edda750..7ffbe7b23b 100644 --- a/samples/MvcSample.Web/Startup.cs +++ b/samples/MvcSample.Web/Startup.cs @@ -31,6 +31,9 @@ namespace MvcSample.Web DefaultHandler = new MvcApplication(serviceProvider), }; + // TODO: Add support for route constraints, so we can potentially constrain by existing routes + routes.MapRoute("{area}/{controller}/{action}"); + routes.MapRoute( "{controller}/{action}", new { controller = "Home", action = "Index" }); diff --git a/samples/MvcSample.Web/Views/Shared/_Layout.cshtml b/samples/MvcSample.Web/Views/Shared/_Layout.cshtml index 1f7c228ce3..3377694bed 100644 --- a/samples/MvcSample.Web/Views/Shared/_Layout.cshtml +++ b/samples/MvcSample.Web/Views/Shared/_Layout.cshtml @@ -27,7 +27,10 @@ @RenderBody()
- @Model.Address + @if (@Model != null) + { + @Model.Address + }