Skip to content

Commit ff74fad

Browse files
committed
Updated sample to use ViewData for home page message.
1 parent 47b9578 commit ff74fad

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Web;
5+
6+
namespace CouchbaseAspNetSample.Constants
7+
{
8+
public static class ViewDataConstants
9+
{
10+
public const string MESSAGE = "Message";
11+
}
12+
}

CouchbaseAspNetSample/Controllers/HomeController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class HomeController : Controller
1414

1515
public ActionResult Index()
1616
{
17-
Session[SessionConstants.MESSAGE] = "Hello, Couchbase ASP.NET!";
17+
ViewData[ViewDataConstants.MESSAGE] = "Hello, Couchbase ASP.NET!";
1818

1919
return View();
2020
}

CouchbaseAspNetSample/Views/Home/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ViewBag.Title = "Home Page";
33
}
44

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

0 commit comments

Comments
 (0)