Skip to content

Commit 159d1ff

Browse files
committed
MVC examples edited
1 parent 837c932 commit 159d1ff

File tree

10 files changed

+57
-245
lines changed

10 files changed

+57
-245
lines changed

src/Examples/Examples.Mvc/Controllers/AdventureWorksController.cs

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System.Linq;
2+
using System.Web.Mvc;
3+
using Examples.Data;
4+
using Examples.Data.ViewModels;
5+
using JQDT.MVC;
6+
7+
namespace Examples.Mvc.Controllers
8+
{
9+
public class VendorsController : Controller
10+
{
11+
private readonly AdventureWorks context;
12+
13+
public VendorsController()
14+
{
15+
this.context = new Examples.Data.AdventureWorks();
16+
}
17+
18+
public ActionResult Index()
19+
{
20+
return this.View();
21+
}
22+
23+
[JQDataTable]
24+
public ActionResult GetVendorsData()
25+
{
26+
var data = this.context.Vendors.Select(x => new
27+
{
28+
BusinessEntityID = x.BusinessEntityID,
29+
CreditRating = x.CreditRating,
30+
ActiveFlag = x.ActiveFlag,
31+
AccountNumber = x.AccountNumber,
32+
ModifiedDate = x.ModifiedDate
33+
});
34+
35+
return this.View(data);
36+
}
37+
}
38+
}

src/Examples/Examples.Mvc/Examples.Mvc.csproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
<Compile Include="App_Start\BundleConfig.cs" />
155155
<Compile Include="App_Start\FilterConfig.cs" />
156156
<Compile Include="App_Start\RouteConfig.cs" />
157-
<Compile Include="Controllers\AdventureWorksController.cs" />
157+
<Compile Include="Controllers\VendorsController.cs" />
158158
<Compile Include="Controllers\CustomersController.cs" />
159159
<Compile Include="Controllers\HomeController.cs" />
160160
<Compile Include="Controllers\ProductsController.cs" />
@@ -169,8 +169,6 @@
169169
<Content Include="Content\bootstrap-theme.min.css" />
170170
<Content Include="Content\bootstrap.css" />
171171
<Content Include="Content\bootstrap.min.css" />
172-
<Content Include="dll\JQDT.dll" />
173-
<Content Include="dll\Test.txt" />
174172
<Content Include="favicon.ico" />
175173
<Content Include="fonts\glyphicons-halflings-regular.svg" />
176174
<Content Include="Global.asax" />
@@ -259,9 +257,7 @@
259257
<Content Include="Views\Home\About.cshtml" />
260258
<Content Include="Views\Home\Contact.cshtml" />
261259
<Content Include="Views\Home\Index.cshtml" />
262-
<Content Include="Views\AdventureWorks\Index.cshtml" />
263-
<Content Include="Views\AdventureWorks\Products.cshtml" />
264-
<Content Include="Views\AdventureWorks\Vendors.cshtml" />
260+
<Content Include="Views\Vendors\Index.cshtml" />
265261
<Content Include="Views\Customers\Index.cshtml" />
266262
<Content Include="Views\Products\Index.cshtml" />
267263
</ItemGroup>

src/Examples/Examples.Mvc/Views/AdventureWorks/Index.cshtml

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/Examples/Examples.Mvc/Views/AdventureWorks/Products.cshtml

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/Examples/Examples.Mvc/Views/Home/Index.cshtml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,22 @@
22
ViewBag.Title = "Home Page";
33
}
44

5-
<div class="jumbotron">
6-
<h1>ASP.NET</h1>
7-
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
8-
<p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
9-
</div>
10-
115
<div class="row">
126
<div class="col-md-4">
13-
<h2>Getting started</h2>
7+
<h2>Products</h2>
148
<p>
15-
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
16-
enables a clean separation of concerns and gives you full control over markup
17-
for enjoyable, agile development.
9+
Example with a simple configuration.
1810
</p>
19-
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p>
11+
<p><a class="btn btn-default" href="~/Products">Learn more &raquo;</a></p>
2012
</div>
2113
<div class="col-md-4">
22-
<h2>Get more libraries</h2>
23-
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
24-
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p>
14+
<h2>Customers</h2>
15+
<p>Example showing the ability to support nested objects.</p>
16+
<p><a class="btn btn-default" href="~/Customers">Learn more &raquo;</a></p>
2517
</div>
2618
<div class="col-md-4">
27-
<h2>Web Hosting</h2>
28-
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
29-
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p>
19+
<h2>Vendors</h2>
20+
<p>Example using custom filters.</p>
21+
<p><a class="btn btn-default" href="~/Vendors">Learn more &raquo;</a></p>
3022
</div>
3123
</div>

src/Examples/Examples.Mvc/Views/Shared/_Layout.cshtml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
</div>
2222
<div class="navbar-collapse collapse">
2323
<ul class="nav navbar-nav">
24-
<li>@Html.ActionLink("Adventure Works Employees", "Index", "AdventureWorks")</li>
25-
<li>@Html.ActionLink("Adventure Works Products", "Products", "AdventureWorks")</li>
26-
<li>@Html.ActionLink("Adventure Works Vendors", "Vendors", "AdventureWorks")</li>
24+
<li>@Html.ActionLink("Vendors", "Index", "Vendors")</li>
2725
<li>@Html.ActionLink("Customers", "Index", "Customers")</li>
2826
<li>@Html.ActionLink("Products", "Index", "Products")</li>
2927
</ul>
@@ -43,4 +41,4 @@
4341
<script src="~/Scripts/DataTables-1.10.16/js/jquery.dataTables.js"></script>
4442
@RenderSection("scripts", required: false)
4543
</body>
46-
</html>
44+
</html>

src/Examples/Examples.Mvc/Views/AdventureWorks/Vendors.cshtml renamed to src/Examples/Examples.Mvc/Views/Vendors/Index.cshtml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div>
2-
Age: from <input type="number" id="minCreditRating" value="1" class="reload-table" />
2+
CreditRating: from <input type="number" id="minCreditRating" value="1" class="reload-table" />
33
to <input type="number" id="maxCreditRating" value="3" class="reload-table" />
44
</div>
55

@@ -11,8 +11,9 @@
1111
Modified Date = <input type="date" id="modifiedDate" value="" class="reload-table" />
1212
</div>
1313

14-
@*<div>Srarting Date: from <input type="date" id="minStartDate" value="" class="reload-table" /> to <input type="date" id="maxStartDate" value="" class="reload-table" /></div>
15-
<div>Street number: from <input type="number" id="minStreetNumber" value="" class="reload-table" /> to <input type="number" id="maxStreetNumber" value="" class="reload-table" /></div>*@
14+
<div>
15+
Account Number = <input type="text" id="accountNumber" value="" class="reload-table" />
16+
</div>
1617

1718
<table id="SearchResultTable" class="display" cellspacing="0" width="100">
1819
<thead>
@@ -43,14 +44,15 @@
4344
"proccessing": true,
4445
"serverSide": true,
4546
"ajax": {
46-
url: "@Url.Action("GetVendorsData", "AdventureWorks")",
47+
url: "@Url.Action("GetVendorsData", "Vendors")",
4748
type: 'POST',
4849
"data": function (d) {
4950
d.custom = {
5051
"filters": {
5152
"CreditRating": { "gte": $('#minCreditRating').val(), "lte": $('#maxCreditRating').val() },
5253
"BusinessEntityID": { "eq": $('#businessEntityId').val() },
5354
"ModifiedDate": { "eq": $('#modifiedDate').val() },
55+
"AccountNumber": { "eq": $('#accountNumber').val() },
5456
}
5557
}
5658
}
-41 KB
Binary file not shown.

src/Examples/Examples.Mvc/dll/Test.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)