Skip to content

Commit b7973d0

Browse files
committed
Updated WWI Application
1 parent f14be6e commit b7973d0

11 files changed

Lines changed: 87 additions & 87 deletions

File tree

samples/databases/wide-world-importers/wwi-app/Controllers/ODataController.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Belgrade.SqlClient;
33
using Microsoft.AspNetCore.Authorization;
44
using Microsoft.AspNetCore.Mvc;
5-
using SqlServerRestApi;
5+
using MsSql.RestApi;
66
using System;
77
using System.IO;
88
using System.Security.Claims;
@@ -18,14 +18,14 @@ public ODataController(ICommand sqlCommandService)
1818
{
1919
this.sqlCmd = sqlCommandService;
2020
}
21-
21+
2222

2323
TableSpec salesorders = new TableSpec("WebApi","SalesOrders", "OrderID,OrderDate,CustomerPurchaseOrderNumber,ExpectedDeliveryDate,PickingCompletedWhen,CustomerID,CustomerName,PhoneNumber,FaxNumber,WebsiteURL,DeliveryLocation,SalesPerson,SalesPersonPhone,SalesPersonEmail");
2424

2525
[HttpGet]
2626
public async Task SalesOrders(int? id)
2727
{
28-
await this.OData(salesorders, this.sqlCmd, id: id).Process();
28+
await this.OData(salesorders, id: id).Process(this.sqlCmd);
2929
}
3030

3131
[Authorize]
@@ -61,12 +61,12 @@ public async Task SalesOrders(int id)
6161
}
6262

6363

64-
TableSpec salesorderlines = new TableSpec("WebApi","SalesOrderLines", "OrderLineID,OrderID,Description,Quantity,UnitPrice,TaxRate,ProductName,Brand,Size,ColorName,PackageTypeName");
64+
TableSpec salesorderlines = new TableSpec("WebApi","SalesOrderLines", "OrderLineID,OrderID,Description,Quantity,UnitPrice,TaxRate,ProductName,Brand,Size,ColorName,PackageTypeName,PickingCompletedWhen");
6565

6666
[HttpGet]
6767
public async Task SalesOrderLines(int? id)
6868
{
69-
await this.OData(salesorderlines, this.sqlCmd, id: id).Process();
69+
await this.OData(salesorderlines, id: id).Process(this.sqlCmd);
7070
}
7171

7272
[Authorize]
@@ -107,7 +107,7 @@ public async Task SalesOrderLines(int id)
107107
[HttpGet]
108108
public async Task PurchaseOrders(int? id)
109109
{
110-
await this.OData(purchaseorders, this.sqlCmd, id: id).Process();
110+
await this.OData(purchaseorders, id: id).Process(this.sqlCmd);
111111
}
112112

113113
[Authorize]
@@ -148,7 +148,7 @@ public async Task PurchaseOrders(int id)
148148
[HttpGet]
149149
public async Task PurchaseOrderLines(int? id)
150150
{
151-
await this.OData(purchaseorderlines, this.sqlCmd, id: id).Process();
151+
await this.OData(purchaseorderlines, id: id).Process(this.sqlCmd);
152152
}
153153

154154
[Authorize]
@@ -189,7 +189,7 @@ public async Task PurchaseOrderLines(int id)
189189
[HttpGet]
190190
public async Task Invoices(int? id)
191191
{
192-
await this.OData(invoices, this.sqlCmd, id: id).Process();
192+
await this.OData(invoices, id: id).Process(this.sqlCmd);
193193
}
194194

195195
[Authorize]
@@ -230,7 +230,7 @@ public async Task Invoices(int id)
230230
[HttpGet]
231231
public async Task SpecialDeals(int? id)
232232
{
233-
await this.OData(specialdeals, this.sqlCmd, id: id).Process();
233+
await this.OData(specialdeals, id: id).Process(this.sqlCmd);
234234
}
235235

236236
[Authorize]
@@ -271,7 +271,7 @@ public async Task SpecialDeals(int id)
271271
[HttpGet]
272272
public async Task CustomerTransactions(int? id)
273273
{
274-
await this.OData(customertransactions, this.sqlCmd, id: id).Process();
274+
await this.OData(customertransactions, id: id).Process(this.sqlCmd);
275275
}
276276

277277
[Authorize]
@@ -312,7 +312,7 @@ public async Task CustomerTransactions(int id)
312312
[HttpGet]
313313
public async Task SupplierTransactions(int? id)
314314
{
315-
await this.OData(suppliertransactions, this.sqlCmd, id: id).Process();
315+
await this.OData(suppliertransactions, id: id).Process(this.sqlCmd);
316316
}
317317

318318
[Authorize]
@@ -353,7 +353,7 @@ public async Task SupplierTransactions(int id)
353353
[HttpGet]
354354
public async Task Customers(int? id)
355355
{
356-
await this.OData(customers, this.sqlCmd, id: id).Process();
356+
await this.OData(customers, id: id).Process(this.sqlCmd);
357357
}
358358

359359
[Authorize]
@@ -394,7 +394,7 @@ public async Task Customers(int id)
394394
[HttpGet]
395395
public async Task Suppliers(int? id)
396396
{
397-
await this.OData(suppliers, this.sqlCmd, id: id).Process();
397+
await this.OData(suppliers, id: id).Process(this.sqlCmd);
398398
}
399399

400400
[Authorize]
@@ -435,7 +435,7 @@ public async Task Suppliers(int id)
435435
[HttpGet]
436436
public async Task Countries(int? id)
437437
{
438-
await this.OData(countries, this.sqlCmd, id: id).Process();
438+
await this.OData(countries, id: id).Process(this.sqlCmd);
439439
}
440440

441441
[Authorize]
@@ -476,7 +476,7 @@ public async Task Countries(int id)
476476
[HttpGet]
477477
public async Task Cities(int? id)
478478
{
479-
await this.OData(cities, this.sqlCmd, id: id).Process();
479+
await this.OData(cities, id: id).Process(this.sqlCmd);
480480
}
481481

482482
[Authorize]
@@ -517,7 +517,7 @@ public async Task Cities(int id)
517517
[HttpGet]
518518
public async Task StateProvinces(int? id)
519519
{
520-
await this.OData(stateprovinces, this.sqlCmd, id: id).Process();
520+
await this.OData(stateprovinces, id: id).Process(this.sqlCmd);
521521
}
522522

523523
[Authorize]
@@ -558,7 +558,7 @@ public async Task StateProvinces(int id)
558558
[HttpGet]
559559
public async Task StockItems(int? id)
560560
{
561-
await this.OData(stockitems, this.sqlCmd, id: id).Process();
561+
await this.OData(stockitems, id: id).Process(this.sqlCmd);
562562
}
563563

564564
[Authorize]
@@ -599,7 +599,7 @@ public async Task StockItems(int id)
599599
[HttpGet]
600600
public async Task PackageTypes(int? id)
601601
{
602-
await this.OData(packagetypes, this.sqlCmd, id: id).Process();
602+
await this.OData(packagetypes, id: id).Process(this.sqlCmd);
603603
}
604604

605605
[Authorize]
@@ -640,7 +640,7 @@ public async Task PackageTypes(int id)
640640
[HttpGet]
641641
public async Task Colors(int? id)
642642
{
643-
await this.OData(colors, this.sqlCmd, id: id).Process();
643+
await this.OData(colors, id: id).Process(this.sqlCmd);
644644
}
645645

646646
[Authorize]
@@ -681,7 +681,7 @@ public async Task Colors(int id)
681681
[HttpGet]
682682
public async Task StockGroups(int? id)
683683
{
684-
await this.OData(stockgroups, this.sqlCmd, id: id).Process();
684+
await this.OData(stockgroups, id: id).Process(this.sqlCmd);
685685
}
686686

687687
[Authorize]
@@ -722,7 +722,7 @@ public async Task StockGroups(int id)
722722
[HttpGet]
723723
public async Task BuyingGroups(int? id)
724724
{
725-
await this.OData(buyinggroups, this.sqlCmd, id: id).Process();
725+
await this.OData(buyinggroups, id: id).Process(this.sqlCmd);
726726
}
727727

728728
[Authorize]
@@ -763,7 +763,7 @@ public async Task BuyingGroups(int id)
763763
[HttpGet]
764764
public async Task CustomerCategories(int? id)
765765
{
766-
await this.OData(customercategories, this.sqlCmd, id: id).Process();
766+
await this.OData(customercategories, id: id).Process(this.sqlCmd);
767767
}
768768

769769
[Authorize]
@@ -804,7 +804,7 @@ public async Task CustomerCategories(int id)
804804
[HttpGet]
805805
public async Task SupplierCategories(int? id)
806806
{
807-
await this.OData(suppliercategories, this.sqlCmd, id: id).Process();
807+
await this.OData(suppliercategories, id: id).Process(this.sqlCmd);
808808
}
809809

810810
[Authorize]
@@ -845,7 +845,7 @@ public async Task SupplierCategories(int id)
845845
[HttpGet]
846846
public async Task TransactionTypes(int? id)
847847
{
848-
await this.OData(transactiontypes, this.sqlCmd, id: id).Process();
848+
await this.OData(transactiontypes, id: id).Process(this.sqlCmd);
849849
}
850850

851851
[Authorize]
@@ -886,7 +886,7 @@ public async Task TransactionTypes(int id)
886886
[HttpGet]
887887
public async Task PaymentMethods(int? id)
888888
{
889-
await this.OData(paymentmethods, this.sqlCmd, id: id).Process();
889+
await this.OData(paymentmethods, id: id).Process(this.sqlCmd);
890890
}
891891

892892
[Authorize]
@@ -927,7 +927,7 @@ public async Task PaymentMethods(int id)
927927
[HttpGet]
928928
public async Task DeliveryMethods(int? id)
929929
{
930-
await this.OData(deliverymethods, this.sqlCmd, id: id).Process();
930+
await this.OData(deliverymethods, id: id).Process(this.sqlCmd);
931931
}
932932

933933
[Authorize]

samples/databases/wide-world-importers/wwi-app/Controllers/ODataController.tt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<#@ assembly name="Newtonsoft.Json" #>
33
<#@ template language="C#" hostspecific="True" #>
44
<#
5-
var o = Newtonsoft.Json.Linq.JObject.Parse(System.IO.File.ReadAllText(this.Host.ResolvePath("..") + "\\appsettings.Development.json"));
5+
var o = Newtonsoft.Json.Linq.JObject.Parse(System.IO.File.ReadAllText(this.Host.ResolvePath("..") + "\\appsettings.json"));
66
var json = o["ApiModel"].ToString();
77
TableDef[] config = Newtonsoft.Json.JsonConvert.DeserializeObject<TableDef[]>(json);
88
#>
99

1010
using Belgrade.SqlClient;
1111
using Microsoft.AspNetCore.Authorization;
1212
using Microsoft.AspNetCore.Mvc;
13-
using SqlServerRestApi;
13+
using MsSql.RestApi;
1414
using System;
1515
using System.IO;
1616
using System.Security.Claims;
@@ -26,7 +26,7 @@ namespace wwi_app.Controllers
2626
{
2727
this.sqlCmd = sqlCommandService;
2828
}
29-
29+
3030
<# foreach(var t in config) {#>
3131

3232
<# if(string.IsNullOrEmpty(t.ODataColumns)) continue; #>
@@ -35,7 +35,7 @@ namespace wwi_app.Controllers
3535
[HttpGet]
3636
public async Task <#= t.Table #>(int? id)
3737
{
38-
await this.OData(<#= t.Table.ToLower() #>, this.sqlCmd, id: id).Process();
38+
await this.OData(<#= t.Table.ToLower() #>, id: id).Process(this.sqlCmd);
3939
}
4040

4141
<# if(!t.IsReadOnly) { #>

0 commit comments

Comments
 (0)