diff --git a/LearningMVC.sln b/LearningMVC.sln
index 3719d8d..f254683 100644
--- a/LearningMVC.sln
+++ b/LearningMVC.sln
@@ -1,12 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26228.10
+VisualStudioVersion = 15.0.26228.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LanguageFeatures", "LanguageFeatures\LanguageFeatures.csproj", "{66040879-2C90-4E02-A07F-824CCFCADD3E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PartyInvites", "..\Lab\PartyInvites\PartyInvites.csproj", "{7E792BFF-6196-4F03-87B7-F84EDE2C6931}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Razor", "Razor\Razor.csproj", "{58B43B8C-F613-4AA5-8A77-98A800578267}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{7E792BFF-6196-4F03-87B7-F84EDE2C6931}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E792BFF-6196-4F03-87B7-F84EDE2C6931}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E792BFF-6196-4F03-87B7-F84EDE2C6931}.Release|Any CPU.Build.0 = Release|Any CPU
+ {58B43B8C-F613-4AA5-8A77-98A800578267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {58B43B8C-F613-4AA5-8A77-98A800578267}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {58B43B8C-F613-4AA5-8A77-98A800578267}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {58B43B8C-F613-4AA5-8A77-98A800578267}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Razor/App_Start/RouteConfig.cs b/Razor/App_Start/RouteConfig.cs
new file mode 100644
index 0000000..885ddfa
--- /dev/null
+++ b/Razor/App_Start/RouteConfig.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+
+namespace Razor
+{
+ public class RouteConfig
+ {
+ public static void RegisterRoutes(RouteCollection routes)
+ {
+ routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+
+ routes.MapRoute(
+ name: "Default",
+ url: "{controller}/{action}/{id}",
+ defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
+ );
+ }
+ }
+}
diff --git a/Razor/Controllers/HomeController.cs b/Razor/Controllers/HomeController.cs
new file mode 100644
index 0000000..1713469
--- /dev/null
+++ b/Razor/Controllers/HomeController.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Razor.Models;
+
+namespace Razor.Controllers
+{
+ public class HomeController : Controller
+ {
+ Product myProduct = new Product
+ {
+ ProductID = 1,
+ Name = "Kayak",
+ Description = "A boat for one person",
+ Category = "Watersports",
+ Price = 275M
+ };
+
+ public ActionResult Index()
+ {
+ return View(myProduct);
+ }
+
+ public ActionResult NameAndPrice()
+ {
+ return View(myProduct);
+ }
+
+ public ActionResult DemoExpression()
+ {
+ ViewBag.ProductCount = 1;
+ ViewBag.ExpressShip = true;
+ ViewBag.ApplyDiscount = false;
+ ViewBag.Supplier = null;
+
+ return View(myProduct);
+ }
+
+ public ActionResult DemoArray()
+ {
+ Product[] array =
+ {
+ new Product {Name = "Kayak", Category = "Watersports", Price = 275M },
+ new Product {Name = "Lifejacket", Category = "Watersports", Price = 48.95M},
+ new Product {Name = "Soccer ball", Category = "Soccer", Price = 19.50M },
+ new Product {Name = "Coner flag", Category = "Soccer", Price = 34.95M }
+ };
+ return View(array);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Razor/Global.asax b/Razor/Global.asax
new file mode 100644
index 0000000..c307304
--- /dev/null
+++ b/Razor/Global.asax
@@ -0,0 +1 @@
+<%@ Application Codebehind="Global.asax.cs" Inherits="Razor.MvcApplication" Language="C#" %>
diff --git a/Razor/Global.asax.cs b/Razor/Global.asax.cs
new file mode 100644
index 0000000..8d56bd7
--- /dev/null
+++ b/Razor/Global.asax.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+
+namespace Razor
+{
+ public class MvcApplication : System.Web.HttpApplication
+ {
+ protected void Application_Start()
+ {
+ AreaRegistration.RegisterAllAreas();
+ RouteConfig.RegisterRoutes(RouteTable.Routes);
+ }
+ }
+}
diff --git a/Razor/Models/Product.cs b/Razor/Models/Product.cs
new file mode 100644
index 0000000..39da2c5
--- /dev/null
+++ b/Razor/Models/Product.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Razor.Models
+{
+ public class Product
+ {
+ public int ProductID { get; set; }
+ public string Name { get; set; }
+ public string Description { get; set; }
+ public decimal Price { get; set; }
+ public string Category { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Razor/Properties/AssemblyInfo.cs b/Razor/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f9a5656
--- /dev/null
+++ b/Razor/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Razor")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Razor")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("58b43b8c-f613-4aa5-8a77-98a800578267")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Razor/Razor.csproj b/Razor/Razor.csproj
new file mode 100644
index 0000000..a3be509
--- /dev/null
+++ b/Razor/Razor.csproj
@@ -0,0 +1,161 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+
+
+ 2.0
+ {58B43B8C-F613-4AA5-8A77-98A800578267}
+ {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
+ Library
+ Properties
+ Razor
+ Razor
+ v4.5.2
+ true
+
+
+
+
+
+
+
+
+
+ true
+ full
+ false
+ bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ true
+ pdbonly
+ true
+ bin\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll
+
+
+ ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.dll
+
+
+ ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Deployment.dll
+
+
+ ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Webpages.Razor.dll
+
+
+ ..\packages\Microsoft.AspNet.Webpages.3.2.3\lib\net45\System.Web.Helpers.dll
+
+
+ ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
+
+
+ ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll
+
+
+
+
+
+
+
+
+
+
+ Global.asax
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Web.config
+
+
+ Web.config
+
+
+
+
+
+
+ 10.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+
+
+
+
+
+
+
+
+ True
+ True
+ 1914
+ /
+ http://localhost:1914/
+ False
+ False
+
+
+ False
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Razor/Views/Home/DemoArray.cshtml b/Razor/Views/Home/DemoArray.cshtml
new file mode 100644
index 0000000..d05f32f
--- /dev/null
+++ b/Razor/Views/Home/DemoArray.cshtml
@@ -0,0 +1,22 @@
+@using Razor.Models
+@model Razor.Models.Product[]
+@{
+ ViewBag.Title = "DemoArray";
+}
+
+@if (Model.Length > 0)
+{
+
+ Product | Price |
+
+ @foreach (Product p in Model)
+ {
+
+ @p.Name |
+ @p.Price |
+
+ }
+
+
+}
+
diff --git a/Razor/Views/Home/DemoExpression.cshtml b/Razor/Views/Home/DemoExpression.cshtml
new file mode 100644
index 0000000..05f93e0
--- /dev/null
+++ b/Razor/Views/Home/DemoExpression.cshtml
@@ -0,0 +1,40 @@
+@model Razor.Models.Product
+
+@{
+ ViewBag.Title = "DemoExpression";
+}
+
+
+
+ Property | Value |
+
+
+ Name | @Model.Name |
+ Price | @Model.Price |
+
+ Stock Level |
+
+ @switch ((int)ViewBag.ProductCount)
+ {
+ case 0:
+ @: Out of Stock
+ break;
+ case 1:
+ Low Stock (@ViewBag.ProductCount)
+ break;
+ case 2:
+ @ViewBag.ProductCount
+ break;
+ }
+ |
+
+
+
+
+
+ The containing element has data attributes
+
+
+Discount:
+Express:
+Supplier:
diff --git a/Razor/Views/Home/Index.cshtml b/Razor/Views/Home/Index.cshtml
new file mode 100644
index 0000000..d4757f5
--- /dev/null
+++ b/Razor/Views/Home/Index.cshtml
@@ -0,0 +1,19 @@
+@model Razor.Models.Product
+
+@{
+ ViewBag.Title = "Product Name";
+}
+
+
+
+
+
+
+ Index
+
+
+
+ Product Name: @Model.Name
+
+
+
diff --git a/Razor/Views/Home/NameAndPrice.cshtml b/Razor/Views/Home/NameAndPrice.cshtml
new file mode 100644
index 0000000..c86fcaf
--- /dev/null
+++ b/Razor/Views/Home/NameAndPrice.cshtml
@@ -0,0 +1,9 @@
+@model Razor.Models.Product
+
+@{
+ ViewBag.Title = "NameAndPrice";
+ Layout = "~/Views/_BasicLayout.cshtml";
+}
+
+NameAndPrice
+The product name is @Model.Name and it costs $@Model.Price
diff --git a/Razor/Views/_BasicLayout.cshtml b/Razor/Views/_BasicLayout.cshtml
new file mode 100644
index 0000000..aec62bb
--- /dev/null
+++ b/Razor/Views/_BasicLayout.cshtml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ @ViewBag.Title
+
+
+
+
Product Information
+
+ @RenderBody()
+
+
+
+
+
diff --git a/Razor/Views/_ViewStart.cshtml b/Razor/Views/_ViewStart.cshtml
new file mode 100644
index 0000000..7ac1ad6
--- /dev/null
+++ b/Razor/Views/_ViewStart.cshtml
@@ -0,0 +1,3 @@
+@{
+ Layout = "~/Views/_BasicLayout.cshtml";
+}
\ No newline at end of file
diff --git a/Razor/Views/web.config b/Razor/Views/web.config
new file mode 100644
index 0000000..6311070
--- /dev/null
+++ b/Razor/Views/web.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Razor/Web.Debug.config b/Razor/Web.Debug.config
new file mode 100644
index 0000000..fae9cfe
--- /dev/null
+++ b/Razor/Web.Debug.config
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Razor/Web.Release.config b/Razor/Web.Release.config
new file mode 100644
index 0000000..da6e960
--- /dev/null
+++ b/Razor/Web.Release.config
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Razor/Web.config b/Razor/Web.config
new file mode 100644
index 0000000..43634a3
--- /dev/null
+++ b/Razor/Web.config
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Razor/packages.config b/Razor/packages.config
new file mode 100644
index 0000000..262d240
--- /dev/null
+++ b/Razor/packages.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file