Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.

Commit a3f2b19

Browse files
committed
Changed to return datatable directly. Prev. json vas double serialized
1 parent b04c2b8 commit a3f2b19

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

SCOM API/Controllers/SCOMPerfController.cs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,10 @@ AND DateTime between @startDate and @endDate
113113
SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
114114
da.Fill(dataTable);
115115

116-
string jsonString = string.Empty;
117-
jsonString = JsonConvert.SerializeObject(dataTable, Formatting.Indented);
118-
119-
// Close connections and reurn data
116+
// Close connections and reurn dataTable
120117
da.Dispose();
121118
DWConnection.Close();
122-
return Ok(jsonString);
119+
return Ok(dataTable);
123120
}
124121

125122
catch (Exception Ex)
@@ -212,13 +209,10 @@ AND DateTime between @startDate and @endDate
212209
SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
213210
da.Fill(dataTable);
214211

215-
string jsonString = string.Empty;
216-
jsonString = JsonConvert.SerializeObject(dataTable, Formatting.Indented);
217-
218-
// Close connections and reurn data
212+
// Close connections and reurn dataTable
219213
da.Dispose();
220214
DWConnection.Close();
221-
return Ok(jsonString);
215+
return Ok(dataTable);
222216
}
223217

224218
catch (Exception Ex)
@@ -315,13 +309,10 @@ AND DateTime between @startDate and @endDate
315309
SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
316310
da.Fill(dataTable);
317311

318-
string jsonString = string.Empty;
319-
jsonString = JsonConvert.SerializeObject(dataTable, Formatting.Indented);
320-
321-
// Close connections and reurn data
312+
// Close connections and reurn dataTable
322313
da.Dispose();
323314
DWConnection.Close();
324-
return Ok(jsonString);
315+
return Ok(dataTable);
325316
}
326317

327318
catch (Exception Ex)

0 commit comments

Comments
 (0)