Skip to content

Commit

Permalink
Updated sample to use ViewData for home page message.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzablocki committed Apr 24, 2012
1 parent 47b9578 commit ff74fad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions CouchbaseAspNetSample/Constants/ViewDataConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CouchbaseAspNetSample.Constants
{
public static class ViewDataConstants
{
public const string MESSAGE = "Message";
}
}
2 changes: 1 addition & 1 deletion CouchbaseAspNetSample/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class HomeController : Controller

public ActionResult Index()
{
Session[SessionConstants.MESSAGE] = "Hello, Couchbase ASP.NET!";
ViewData[ViewDataConstants.MESSAGE] = "Hello, Couchbase ASP.NET!";

return View();
}
Expand Down
2 changes: 1 addition & 1 deletion CouchbaseAspNetSample/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ViewBag.Title = "Home Page";
}

<h2>@Session[CouchbaseAspNetSample.Constants.SessionConstants.MESSAGE]</h2>
<h2>@ViewBag.Message</h2>
<p>
To learn more about Couchbase and .NET visit
<a href="http://couchbase.com/develop/net/current" title="Couchbase .NET Client Library Documentation">http://couchbase.com/develop/net/current</a>.
Expand Down

0 comments on commit ff74fad

Please sign in to comment.