diff --git a/20230415.3/w230415/w230415.sln b/20230415.3/w230415/w230415.sln index b2ee3d8..7ea15dd 100644 --- a/20230415.3/w230415/w230415.sln +++ b/20230415.3/w230415/w230415.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "w230415_console", "..\w2304 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "w230415_webapi", "..\w230415_webapi\w230415_webapi.csproj", "{465CAE58-3BB5-4933-8AB8-FE30DDCFB9C4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "w230415_consoleapi", "..\w230415_consoleapi\w230415_consoleapi.csproj", "{96A7178E-082A-4E3B-A377-948D0B1E66DA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {465CAE58-3BB5-4933-8AB8-FE30DDCFB9C4}.Debug|Any CPU.Build.0 = Debug|Any CPU {465CAE58-3BB5-4933-8AB8-FE30DDCFB9C4}.Release|Any CPU.ActiveCfg = Release|Any CPU {465CAE58-3BB5-4933-8AB8-FE30DDCFB9C4}.Release|Any CPU.Build.0 = Release|Any CPU + {96A7178E-082A-4E3B-A377-948D0B1E66DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96A7178E-082A-4E3B-A377-948D0B1E66DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96A7178E-082A-4E3B-A377-948D0B1E66DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96A7178E-082A-4E3B-A377-948D0B1E66DA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/20230415.3/w230415_consoleapi/Program.cs b/20230415.3/w230415_consoleapi/Program.cs new file mode 100644 index 0000000..e76b8c2 --- /dev/null +++ b/20230415.3/w230415_consoleapi/Program.cs @@ -0,0 +1,42 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using w230415_classes; + +namespace w230415_consoleapi +{ + internal class Program + { + static void Main(string[] args) + { + h_Process(); + } + + private static void h_Process() + { + HttpClient client = new HttpClient(); + var res = client.GetAsync("http://localhost:5095/v1/hall").Result; + if (res.StatusCode == System.Net.HttpStatusCode.OK) + { + string sJson = res.Content.ReadAsStringAsync().Result; + //// 1. self + List? chList = JsonConvert.DeserializeObject>(sJson); + foreach (HallPlace item in chList) + { + Console.WriteLine($"{item.SeatRow}/{item.SeatPosition}: {item.Uid}"); + } + // 2. dynamic + //dynamic json = JsonConvert.DeserializeObject(sJson); + //foreach (dynamic item in json) + //{ + // Console.WriteLine($"{item.seatRow}/{item.seatPosition}: {item.uid}"); + //} + // 3. JToken + //JToken json = JsonConvert.DeserializeObject(sJson); + //foreach (JToken item in json) + //{ + // Console.WriteLine($"{item["seatRow"]}/{item["seatPosition"]}: {item["uid"]}"); + //} + } + } + } +} \ No newline at end of file diff --git a/20230415.3/w230415_consoleapi/w230415_consoleapi.csproj b/20230415.3/w230415_consoleapi/w230415_consoleapi.csproj new file mode 100644 index 0000000..7a634fa --- /dev/null +++ b/20230415.3/w230415_consoleapi/w230415_consoleapi.csproj @@ -0,0 +1,18 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + + +