01.
Namespace
SR_APIService02.Controllers.Sura
02.
03.
<Route(
"api/[controller]"
)>
04.
Partial
Public
Class
SuraController :
Inherits
ControllerBase
05.
06.
07.
08.
09.
<Route(
"GetAllWarehouse"
)>
10.
<HttpGet>
11.
Public
Function
GetAllWarehouse()
As
IActionResult
12.
Dim
strSQL =
13.
<Suparuck>
14.
Select
a.wh_code, a.thai_name, b.province_name, a.ass_1 From id_warehouse a
15.
Left Join id_province b on a.province_code = b.province_code
16.
order by a.wh_code asc
17.
</Suparuck>
18.
19.
Dim
results
As
IList(Of
Object
)
20.
Dim
fakeList = {
New
With
{.Id =
""
, .Text =
""
, .Remark =
""
, .Remark2 =
""
}}.Take(0).ToList()
21.
22.
23.
24.
Using cn = SexyDatabase.SexyConnection()
25.
results = cn.Query(Of
Object
)(strSQL.Value)
26.
End
Using
27.
28.
For
Each
r
In
results
29.
Dim
fields =
DirectCast
(r, IDictionary(Of
String
,
Object
))
30.
31.
Dim
f1 =
If
(Convert.IsDBNull(fields(
"wh_code"
)),
""
, fields(
"wh_code"
).ToString())
32.
Dim
f2 =
If
(Convert.IsDBNull(fields(
"thai_name"
)),
""
, fields(
"thai_name"
).ToString())
33.
Dim
f3 =
If
(Convert.IsDBNull(fields(
"province_name"
)),
""
, fields(
"province_name"
).ToString())
34.
fakeList.Add(
New
With
{.Id = f1, .Text = f2, .Remark = f1 + f2 + f3, .remark2 = f3})
35.
Next
36.
Return
Ok(fakeList.ToList())
37.
End
Function
38.
End
Namepace