diff --git a/AttributeRoutingDemoInMVC/AttributeRoutingDemoInMVC.csproj b/AttributeRoutingDemoInMVC/AttributeRoutingDemoInMVC.csproj
index 56c3f6a..2a2797e 100644
--- a/AttributeRoutingDemoInMVC/AttributeRoutingDemoInMVC.csproj
+++ b/AttributeRoutingDemoInMVC/AttributeRoutingDemoInMVC.csproj
@@ -168,6 +168,8 @@
+
+
diff --git a/AttributeRoutingDemoInMVC/Controllers/HomeController.cs b/AttributeRoutingDemoInMVC/Controllers/HomeController.cs
index 33f935d..04a391b 100644
--- a/AttributeRoutingDemoInMVC/Controllers/HomeController.cs
+++ b/AttributeRoutingDemoInMVC/Controllers/HomeController.cs
@@ -8,22 +8,23 @@ namespace AttributeRoutingDemoInMVC.Controllers
{
public class HomeController : Controller
{
- public ActionResult Index()
+ // Optional URI Parameter
+ // URL: /MVCTest/
+ // URL: /MVCTest/Pranaya
+ [Route("MVCTest/{studentName ?}")]
+ public ActionResult MVC(string studentName)
{
+ ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
- public ActionResult About()
+ // Optional URI Parameter with default value
+ // URL: /WEBAPITest/
+ // URL: /WEBAPITest/Pranaya
+ [Route("WEBAPITest/{studentName = Pranaya}")]
+ public ActionResult WEBAPI(string studentName)
{
- ViewBag.Message = "Your application description page.";
-
- return View();
- }
-
- public ActionResult Contact()
- {
- ViewBag.Message = "Your contact page.";
-
+ ViewBag.Message = "Welcome to ASP.NET WEB API!";
return View();
}
}
diff --git a/AttributeRoutingDemoInMVC/Views/Home/MVC.cshtml b/AttributeRoutingDemoInMVC/Views/Home/MVC.cshtml
new file mode 100644
index 0000000..f564ac0
--- /dev/null
+++ b/AttributeRoutingDemoInMVC/Views/Home/MVC.cshtml
@@ -0,0 +1,4 @@
+@{
+ ViewBag.Title = "MVC";
+}
+@ViewBag.Message
\ No newline at end of file
diff --git a/AttributeRoutingDemoInMVC/Views/Home/WEBAPI.cshtml b/AttributeRoutingDemoInMVC/Views/Home/WEBAPI.cshtml
new file mode 100644
index 0000000..0739c30
--- /dev/null
+++ b/AttributeRoutingDemoInMVC/Views/Home/WEBAPI.cshtml
@@ -0,0 +1,4 @@
+@{
+ ViewBag.Title = "WEBAPI";
+}
+@ViewBag.Message
\ No newline at end of file