forked from extnet/Ext.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainController.cs
More file actions
71 lines (60 loc) · 1.96 KB
/
MainController.cs
File metadata and controls
71 lines (60 loc) · 1.96 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Net;
namespace Ext.Net.MVC.Examples
{
[DirectController]
public class MainController : System.Web.Mvc.Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Home()
{
return View();
}
[OutputCache(Duration = 3600)]
public ActionResult GetExamplesNodes(string node)
{
if (node == "Root")
{
return this.Content(ExamplesModel.GetExamplesNodes().ToJson());
}
return new HttpStatusCodeResult((int)HttpStatusCode.BadRequest);
}
[DirectMethod]
[OutputCache(Duration=86400, VaryByParam="theme")]
public DirectResult GetThemeUrl(string theme)
{
Theme temp = (Theme)Enum.Parse(typeof(Theme), theme);
this.Session["Ext.Net.Theme"] = temp;
return this.Direct(temp == Ext.Net.Theme.Default ? "Default" : MvcResourceManager.GetThemeUrl(temp));
}
[DirectMethod]
[OutputCache(Duration = 86400, VaryByParam = "name")]
public DirectResult GetHashCode(string name)
{
return this.Direct(Math.Abs(name.ToLower().GetHashCode()));
}
[DirectMethod]
public DirectResult ChangeScriptMode(bool debug)
{
if (debug)
{
this.Session["Ext.Net.ScriptMode"] = Ext.Net.ScriptMode.Debug;
this.Session["Ext.Net.SourceFormatting"] = true;
}
else
{
this.Session["Ext.Net.ScriptMode"] = Ext.Net.ScriptMode.Release;
this.Session["Ext.Net.SourceFormatting"] = false;
}
Response.Redirect("");
return this.Direct();
}
}
}