Skip to content

Commit 9b26530

Browse files
committed
Added more donut holes in the page, for the fun.
1 parent 8d7ba22 commit 9b26530

File tree

6 files changed

+63
-16
lines changed

6 files changed

+63
-16
lines changed
Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Web;
52
using System.Web.Mvc;
63

74
namespace DevTrends.MvcDonutCaching.Demo.Controllers
85
{
96
public class HomeController : Controller
107
{
8+
public ActionResult Index()
9+
{
10+
return RedirectToAction("Simple");
11+
}
12+
1113
//
1214
// GET: /Home/
1315
[DonutOutputCache(Duration = 24 * 3600)]
14-
public ActionResult Index()
16+
public ActionResult Simple()
1517
{
1618
return View(DateTime.Now);
1719
}
20+
21+
[ChildActionOnly, DonutOutputCache(Duration = 60)]
22+
public ActionResult SimpleDonutOne()
23+
{
24+
return PartialView(DateTime.Now);
25+
}
26+
27+
[ChildActionOnly]
28+
public ActionResult SimpleDonutTwo()
29+
{
30+
return PartialView(DateTime.Now);
31+
}
1832
}
1933
}

DevTrends.MvcDonutCaching.Demo/MvcDonutCaching.Demo.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@
149149
</Content>
150150
<Content Include="Views\Web.config" />
151151
</ItemGroup>
152-
<ItemGroup />
152+
<ItemGroup>
153+
<Content Include="Views\Home\SimpleDonutOne.cshtml" />
154+
</ItemGroup>
153155
<ItemGroup>
154156
<Content Include="packages.config">
155157
<SubType>Designer</SubType>
@@ -162,7 +164,7 @@
162164
</ProjectReference>
163165
</ItemGroup>
164166
<ItemGroup>
165-
<Content Include="Views\Home\Index.cshtml" />
167+
<Content Include="Views\Home\Simple.cshtml" />
166168
</ItemGroup>
167169
<ItemGroup>
168170
<Content Include="Views\_ViewStart.cshtml" />
@@ -182,6 +184,9 @@
182184
<ItemGroup>
183185
<Content Include="Views\Account\ChangePassword.cshtml" />
184186
</ItemGroup>
187+
<ItemGroup>
188+
<Content Include="Views\Home\SimpleDonutTwo.cshtml" />
189+
</ItemGroup>
185190
<PropertyGroup>
186191
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
187192
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

DevTrends.MvcDonutCaching.Demo/Views/Home/Index.cshtml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@model DateTime
2+
@{
3+
ViewBag.Title = "Donut holes demo";
4+
}
5+
6+
<h2>@ViewBag.Title</h2>
7+
8+
<p>
9+
This page has been rendered at @Model (expires in 24h)
10+
</p>
11+
12+
<div>
13+
@Html.Action("SimpleDonutOne", true)
14+
</div>
15+
16+
<p>
17+
This is again the main page
18+
</p>
19+
20+
<div>
21+
@Html.Action("SimpleDonutTwo", true)
22+
</div>
23+
24+
<p>
25+
This is again again the main page
26+
</p>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@model DateTime
2+
3+
<p>
4+
Donut rendered at : @Model (expires every 60 seconds)
5+
</p>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@model DateTime
2+
3+
<p>
4+
This is another donut, not cached at all
5+
<br />
6+
Generated at : @Model
7+
</p>

0 commit comments

Comments
 (0)