Skip to content

Commit 1e58c37

Browse files
Updated
1 parent ba2ebde commit 1e58c37

File tree

2 files changed

+6
-6
lines changed
  • Binding PostgreSQL database using CustomAdaptor/Grid_PostgreSQL_Custom/Grid_PostgreSQL_Custom.Server/Controllers
  • Binding PostgreSQL database using UrlAdaptor/Grid_PostgreSQL/Grid_PostgreSQL.Server/Controllers

2 files changed

+6
-6
lines changed

Binding PostgreSQL database using CustomAdaptor/Grid_PostgreSQL_Custom/Grid_PostgreSQL_Custom.Server/Controllers/GridController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public IActionResult BatchUpdate([FromBody] CRUDModel<Orders> value)
184184
foreach (Orders Record in (IEnumerable<Orders>)value.changed)
185185
{
186186
// Create query to update the changes into the database by accessing its properties.
187-
string queryStr = $"Update \"Orders\" set \"CustomerID\"='{value.value.CustomerID}', \"Freight\"={value.value.Freight},\"EmployeeID\"={value.value.EmployeeID},\"ShipCity\"='{value.value.ShipCity}' where \"OrderID\"={value.value.OrderID}";
187+
string queryStr = $"Update \"Orders\" set \"CustomerID\"='{Record.CustomerID}', \"Freight\"={Record.Freight},\"EmployeeID\"={Record.EmployeeID},\"ShipCity\"='{Record.ShipCity}' where \"OrderID\"={Record.OrderID}";
188188

189189
// Create a new NpgsqlConnection object using the connection string.
190190
NpgsqlConnection Connection = new NpgsqlConnection(ConnectionString);
@@ -209,7 +209,7 @@ public IActionResult BatchUpdate([FromBody] CRUDModel<Orders> value)
209209
foreach (Orders Record in (IEnumerable<Orders>)value.added)
210210
{
211211
// Create query to insert the specific into the database by accessing its properties.
212-
string queryStr = $"Insert into \"Orders\" (\"CustomerID\", \"Freight\", \"ShipCity\", \"EmployeeID\") values('{value.value.CustomerID}',{value.value.Freight},'{value.value.ShipCity}','{value.value.EmployeeID}')";
212+
string queryStr = $"Insert into \"Orders\" (\"CustomerID\", \"Freight\", \"ShipCity\", \"EmployeeID\") values('{Record.CustomerID}',{Record.Freight},'{Record.ShipCity}','{Record.EmployeeID}')";
213213

214214
// Create a new NpgsqlConnection object using the connection string.
215215
NpgsqlConnection Connection = new NpgsqlConnection(ConnectionString);
@@ -234,7 +234,7 @@ public IActionResult BatchUpdate([FromBody] CRUDModel<Orders> value)
234234
foreach (Orders Record in (IEnumerable<Orders>)value.deleted)
235235
{
236236
//Create query to remove the specific from database by passing the primary key column value.
237-
string queryStr = $"DELETE FROM \"Orders\" WHERE \"OrderID\" = {value.key}";
237+
string queryStr = $"DELETE FROM \"Orders\" WHERE \"OrderID\" = {Record.OrderID}";
238238

239239
// Create a new NpgsqlConnection object using the connection string.
240240
NpgsqlConnection Connection = new NpgsqlConnection(ConnectionString);

Binding PostgreSQL database using UrlAdaptor/Grid_PostgreSQL/Grid_PostgreSQL.Server/Controllers/GridController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public IActionResult BatchUpdate([FromBody] CRUDModel<Orders> value)
186186
foreach (Orders Record in (IEnumerable<Orders>)value.changed)
187187
{
188188
// Create query to update the changes into the database by accessing its properties.
189-
string queryStr = $"Update \"Orders\" set \"CustomerID\"='{value.value.CustomerID}', \"Freight\"={value.value.Freight},\"EmployeeID\"={value.value.EmployeeID},\"ShipCity\"='{value.value.ShipCity}' where \"OrderID\"={value.value.OrderID}";
189+
string queryStr = $"Update \"Orders\" set \"CustomerID\"='{Record.CustomerID}', \"Freight\"={Record.Freight},\"EmployeeID\"={Record.EmployeeID},\"ShipCity\"='{Record.ShipCity}' where \"OrderID\"={Record.OrderID}";
190190

191191
// Create a new NpgsqlConnection object using the connection string.
192192
NpgsqlConnection Connection = new NpgsqlConnection(ConnectionString);
@@ -211,7 +211,7 @@ public IActionResult BatchUpdate([FromBody] CRUDModel<Orders> value)
211211
foreach (Orders Record in (IEnumerable<Orders>)value.added)
212212
{
213213
// Create query to insert the specific into the database by accessing its properties.
214-
string queryStr = $"Insert into \"Orders\" (\"CustomerID\", \"Freight\", \"ShipCity\", \"EmployeeID\") values('{value.value.CustomerID}',{value.value.Freight},'{value.value.ShipCity}','{value.value.EmployeeID}')";
214+
string queryStr = $"Insert into \"Orders\" (\"CustomerID\", \"Freight\", \"ShipCity\", \"EmployeeID\") values('{Record.CustomerID}',{Record.Freight},'{Record.ShipCity}','{Record.EmployeeID}')";
215215

216216
// Create a new NpgsqlConnection object using the connection string.
217217
NpgsqlConnection Connection = new NpgsqlConnection(ConnectionString);
@@ -236,7 +236,7 @@ public IActionResult BatchUpdate([FromBody] CRUDModel<Orders> value)
236236
foreach (Orders Record in (IEnumerable<Orders>)value.deleted)
237237
{
238238
//Create query to remove the specific from database by passing the primary key column value.
239-
string queryStr = $"DELETE FROM \"Orders\" WHERE \"OrderID\" = {value.key}";
239+
string queryStr = $"DELETE FROM \"Orders\" WHERE \"OrderID\" = {Record.OrderID}";
240240

241241
// Create a new NpgsqlConnection object using the connection string.
242242
NpgsqlConnection Connection = new NpgsqlConnection(ConnectionString);

0 commit comments

Comments
 (0)