This repository has been archived by the owner on Dec 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDefaultController.cs
98 lines (87 loc) · 1.6 KB
/
DefaultController.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;
namespace Zongsoft.Web.Launcher
{
[HandleError]
public class DefaultController : Controller
{
public ActionResult Index()
{
this.ViewData["Now"] = DateTime.Now;
this.ViewData["Random"] = Zongsoft.Common.Randomizer.GenerateInt32();
this.ViewData["Message"] = "Welcome to ASP.NET MVC on Zongsoft.Plugins™";
this.ViewData["Genders"] = Zongsoft.Common.EnumUtility.GetEnumEntries(typeof(Gender), false);
this.ViewData["PluginTree"] = Zongsoft.Plugins.Application.Context.PluginContext.PluginTree;
var people = new Person[]
{
new Person()
{
Id = 101,
Name = "Administrator",
Gender = Gender.Male,
Birthdate = new DateTime(1980, 1, 1),
},
new Person()
{
Id = 102,
Name = "Popeye Zhong",
Gender = Gender.Male,
Birthdate = new DateTime(1979, 5, 15),
},
new Person()
{
Id = 103,
Name = "Lily",
Gender = Gender.Female,
Birthdate = new DateTime(1989, 6, 1),
},
};
return View(people);
}
[HttpPost]
public ActionResult Index(int? id)
{
return View();
}
public ActionResult About()
{
return View();
}
}
#region 测试数据
public enum Gender
{
[Description("先生")]
Male = 1,
[Description("女士")]
Female = 0,
}
[Serializable]
public class Person
{
public int Id
{
get;
set;
}
public string Name
{
get;
set;
}
public Gender? Gender
{
get;
set;
}
public DateTime Birthdate
{
get;
set;
}
}
#endregion
}