forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeController.cs
More file actions
52 lines (46 loc) · 1.16 KB
/
Copy pathHomeController.cs
File metadata and controls
52 lines (46 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Web.Mvc;
using ServiceStack;
using ServiceStack.Mvc;
namespace CheckMvc.Controllers
{
public class HomeViewModel
{
public string Name { get; set; }
public long Counter { get; set; }
public string Json { get; set; }
}
public class TestObj
{
public int Id { get; set; }
public DateTime CurrentDate { get; set; }
}
public class HomeController : ServiceStackController
{
public ActionResult Index()
{
return View(GetViewModel("Index"));
}
private HomeViewModel GetViewModel(string name)
{
return new HomeViewModel
{
Name = name,
Counter = Redis.IncrementValue("counter:" + name),
Json = new TestObj
{
Id = 1,
CurrentDate = DateTime.Now
}.ToJson()
};
}
public ActionResult About()
{
return View(GetViewModel("About"));
}
public ActionResult Contact()
{
return View(GetViewModel("Contact"));
}
}
}