Skip to content

Commit f56200d

Browse files
authored
Merge pull request telerik#30 from telerik/cell-format-excel-update
chore: update-cell-format-exel-example-for-local-data
2 parents a204b00 + a47f991 commit f56200d

12 files changed

+79
-1832
lines changed

Diff for: grid/cell-format-excel/KendoUIMVC5/Controllers/HomeController.cs

+50-14
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,62 @@ namespace KendoUIMVC5.Controllers
1111
{
1212
public class HomeController : Controller
1313
{
14-
public ActionResult Index()
14+
public static ICollection<Student> students = new List<Student>();
15+
16+
public HomeController()
1517
{
16-
ViewBag.Message = "Welcome to ASP.NET MVC!";
18+
var names = new List<string> { "John", "Jane", "Jeremy", "James" };
19+
var lastNames = new List<string> { "Hammont", "Clarkson", "May", "Hennethon" };
20+
var random = new Random();
21+
if (students.Count == 0)
22+
{
23+
for (int i = 1; i < 50; i++)
24+
{
25+
students.Add(new Student
26+
{
27+
Age = random.Next(1, 20),
28+
Birthday = new DateTime(random.Next(1950, 2018), random.Next(1, 12), random.Next(1, 27)),
29+
FirstName = names[random.Next(0, 4)],
30+
LastName = lastNames[random.Next(0, 4)],
31+
Id = i
32+
});
33+
}
34+
}
35+
}
1736

37+
public ActionResult Index()
38+
{
1839
return View();
1940
}
2041

21-
public ActionResult Orders_Read([DataSourceRequest]DataSourceRequest request)
42+
43+
44+
public ActionResult GetStudents([DataSourceRequest] DataSourceRequest request)
2245
{
23-
using (var northwind = new NorthwindEntities())
24-
{
25-
return Json(northwind.Orders.ToDataSourceResult(request, o => new
26-
{
27-
o.OrderID,
28-
o.Freight,
29-
o.OrderDate,
30-
o.ShipName,
31-
o.ShipCity
32-
}));
33-
}
46+
47+
return Json(students.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
48+
}
49+
50+
public ActionResult EditStudent(Student student)
51+
{
52+
students.Where(x => x.Id == student.Id).Select(x => student);
53+
54+
return Json(student);
55+
}
56+
57+
public ActionResult CreateStudent(Student student)
58+
{
59+
student.Id = students.Count + 1;
60+
students.Add(student);
61+
62+
return Json(student);
63+
}
64+
65+
public ActionResult DestroyStudent(Student student)
66+
{
67+
students.Remove(students.First(x => x.Id == student.Id));
68+
69+
return Json(student);
3470
}
3571
}
3672
}

Diff for: grid/cell-format-excel/KendoUIMVC5/KendoUIMVC5.csproj

+3-39
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<IISExpressAnonymousAuthentication />
2121
<IISExpressWindowsAuthentication />
2222
<IISExpressUseClassicPipelineMode />
23+
<Use64BitIISExpress />
24+
<UseGlobalApplicationHostFile />
2325
</PropertyGroup>
2426
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2527
<DebugSymbols>true</DebugSymbols>
@@ -121,24 +123,7 @@
121123
<Compile Include="Global.asax.cs">
122124
<DependentUpon>Global.asax</DependentUpon>
123125
</Compile>
124-
<Compile Include="Models\Northwind.Context.cs">
125-
<AutoGen>True</AutoGen>
126-
<DesignTime>True</DesignTime>
127-
<DependentUpon>Northwind.Context.tt</DependentUpon>
128-
</Compile>
129-
<Compile Include="Models\Northwind.cs">
130-
<AutoGen>True</AutoGen>
131-
<DesignTime>True</DesignTime>
132-
<DependentUpon>Northwind.tt</DependentUpon>
133-
</Compile>
134-
<Compile Include="Models\Northwind.Designer.cs">
135-
<AutoGen>True</AutoGen>
136-
<DesignTime>True</DesignTime>
137-
<DependentUpon>Northwind.edmx</DependentUpon>
138-
</Compile>
139-
<Compile Include="Models\Order.cs">
140-
<DependentUpon>Northwind.tt</DependentUpon>
141-
</Compile>
126+
<Compile Include="Models\Student.cs" />
142127
<Compile Include="Properties\AssemblyInfo.cs" />
143128
</ItemGroup>
144129
<ItemGroup>
@@ -149,16 +134,6 @@
149134
<Content Include="favicon.ico" />
150135
<Content Include="Global.asax" />
151136
<Content Include="Content\Site.css" />
152-
<Content Include="Models\Northwind.Context.tt">
153-
<Generator>TextTemplatingFileGenerator</Generator>
154-
<DependentUpon>Northwind.edmx</DependentUpon>
155-
<LastGenOutput>Northwind.Context.cs</LastGenOutput>
156-
</Content>
157-
<Content Include="Models\Northwind.tt">
158-
<Generator>TextTemplatingFileGenerator</Generator>
159-
<DependentUpon>Northwind.edmx</DependentUpon>
160-
<LastGenOutput>Northwind.cs</LastGenOutput>
161-
</Content>
162137
<Content Include="Scripts\kendo.modernizr.custom.js" />
163138
<Content Include="Scripts\_references.js" />
164139
<Content Include="Web.config" />
@@ -189,17 +164,6 @@
189164
<ItemGroup>
190165
<Content Include="packages.config" />
191166
</ItemGroup>
192-
<ItemGroup>
193-
<EntityDeploy Include="Models\Northwind.edmx">
194-
<Generator>EntityModelCodeGenerator</Generator>
195-
<LastGenOutput>Northwind.Designer.cs</LastGenOutput>
196-
</EntityDeploy>
197-
</ItemGroup>
198-
<ItemGroup>
199-
<Content Include="Models\Northwind.edmx.diagram">
200-
<DependentUpon>Northwind.edmx</DependentUpon>
201-
</Content>
202-
</ItemGroup>
203167
<ItemGroup>
204168
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
205169
</ItemGroup>

Diff for: grid/cell-format-excel/KendoUIMVC5/Models/Northwind.Context.cs

-30
This file was deleted.

0 commit comments

Comments
 (0)