Permalink
Browse files

Tidied up for blog post and simulated ViewBag in Nancy project.

  • Loading branch information...
1 parent 9d29254 commit e0e79659c12f5623cd32013be03a7c4b98366ece @benfoster committed Apr 2, 2013
@@ -1,21 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using System.Web.Mvc;
+using System.Web.Mvc;
namespace NancyVsMvc.Mvc.Controllers
{
public class HomeController : Controller
{
- //
- // GET: /Home/
-
public ActionResult Index()
{
ViewBag.WelcomeMessage = "Welcome to ASP.NET MVC!";
return View();
}
-
}
}
@@ -1,9 +1,7 @@
@{
Layout = null;
}
-
<!DOCTYPE html>
-
<html>
<head>
<meta name="viewport" content="width=device-width" />
@@ -14,4 +12,4 @@
<h1>@ViewBag.WelcomeMessage</h1>
</div>
</body>
-</html>
+</html>
@@ -1,8 +1,4 @@
using Nancy;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
namespace NancyVsMvc.Nancy.Modules
{
@@ -12,7 +8,9 @@ public HomeModule()
{
Get["/"] = _ =>
{
- return View["home", new { WelcomeMessage = "Welcome to Nancy!" }];
+ dynamic viewBag = new DynamicDictionary();
+ viewBag.WelcomeMessage = "Welcome to Nancy!";
+ return View["home", viewBag];
};
}
}

0 comments on commit e0e7965

Please sign in to comment.