-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathCommonController.cs
145 lines (118 loc) · 4.85 KB
/
CommonController.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
using DevExtreme.AspNet.Data;
using DevExtreme.AspNet.Mvc;
using DevExtreme.MVC.Demos.Models;
using DevExtreme.MVC.Demos.Models.SampleData;
using DevExtreme.MVC.Demos.ViewModels;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DevExtreme.MVC.Demos.Models.DataGrid;
namespace DevExtreme.MVC.Demos.Controllers {
public class CommonController : Controller {
#region EditorsRightToLeftSupport
public ActionResult EditorsRightToLeftSupport() {
var directionCookie = Request.Cookies["direction"];
var rtl = directionCookie != null && directionCookie.Value == "rtl";
return View(new RtlViewModel {
LanguageItems = new[] {
"Arabic: Right-to-Left direction",
"English: Left-to-Right direction"
},
Text = rtl ? "نص" : "text",
DisplayExpr = rtl ? "NameAr" : "NameEn",
RtlEnabled = rtl
});
}
[HttpGet]
public ActionResult GetEuropeanUnionData(DataSourceLoadOptions loadOptions) {
return Content(JsonConvert.SerializeObject(DataSourceLoader.Load(SampleData.EuropeanUnion, loadOptions)), "application/json");
}
#endregion
#region EditorsOverview
public ActionResult EditorsOverview() {
return View();
}
#endregion
#region FormsAndMultiPurposeOverview
public ActionResult FormsAndMultiPurposeOverview() {
return View(new FormViewModel {
ID = 1,
FirstName = "John",
LastName = "Heart",
Position = "CEO",
BirthDate = DateTime.Parse("1964 /03/16"),
HireDate = DateTime.Parse("1995 /01/15"),
Notes = "John has been in the Audio/Video industry since 1990. He has led DevAV as its CEO since 2003.\r\nWhen not working hard as the CEO, John loves to golf and bowl. He once bowled a perfect game of 300.",
Address = "351 S Hill St.",
City = "Los Angeles",
State = "CA",
Zipcode = "90013",
Phone = "555-684-1335",
Email = "jheart@dx-email.com",
Skype = "jheart_DX_skype",
});
}
#endregion
#region NavigationRightToLeftSupport
public ActionResult NavigationRightToLeftSupport() {
var directionCookie = Request.Cookies["direction"];
var rtl = directionCookie != null && directionCookie.Value == "rtl";
return View(new RtlViewModel {
LanguageItems = new[] {
"Arabic: Right-to-Left direction",
"English: Left-to-Right direction"
},
DisplayExpr = rtl ? "NameAr" : "NameEn",
RtlEnabled = rtl
});
}
[HttpGet]
public ActionResult GetContinentsData(DataSourceLoadOptions loadOptions) {
return Content(JsonConvert.SerializeObject(DataSourceLoader.Load(SampleData.Continents, loadOptions)), "application/json");
}
[HttpGet]
public ActionResult GetEuropeanCountriesData(DataSourceLoadOptions loadOptions) {
return Content(JsonConvert.SerializeObject(DataSourceLoader.Load(SampleData.EuropeanCountries.Take(4), loadOptions)), "application/json");
}
#endregion
#region NavigationOverview
public ActionResult NavigationOverview() {
return View(SampleData.ContinentsInfo.FirstOrDefault().Items.First());
}
public ActionResult GetContinentsInfo(DataSourceLoadOptions loadOptions) {
return Content(JsonConvert.SerializeObject(DataSourceLoader.Load(SampleData.ContinentsInfo, loadOptions)), "application/json");
}
#endregion
#region ActionAndListsOverview
public ActionResult ActionAndListsOverview() {
return View();
}
#endregion
public ActionResult DialogsAndNotificationsOverview() {
var i = 0;
return View(SampleData.GalleryItems.Select(a => new GalleryItem {
ID = a.ID,
Address = a.Address,
City = a.City,
State = a.State,
Price = a.Price,
Features = a.Features,
Image = a.Image,
Agent = SampleData.DataGridEmployees.Skip(i++ % 4).FirstOrDefault()
}));
}
#region CustomTextEditorButtons
public ActionResult CustomTextEditorButtons() {
return View();
}
#endregion
#region EditorAppearanceVariants
public ActionResult EditorAppearanceVariants() {
return View();
}
#endregion
}
}