diff --git a/WD7UVN_HFT_2023241.Client/CRUD.cs b/WD7UVN_HFT_2023241.Client/CRUD.cs index 782d82a..a16d4a8 100644 --- a/WD7UVN_HFT_2023241.Client/CRUD.cs +++ b/WD7UVN_HFT_2023241.Client/CRUD.cs @@ -119,7 +119,7 @@ namespace WD7UVN_HFT_2023241.Client public static void Customer() { - foreach (Customer c in RestService.Get("/api/Customer")) + foreach (Customer c in RestService.Get("/api/Customer/")) { Console.WriteLine("Name: " + c.NAME); Console.WriteLine("ID: " + c.ID); @@ -133,7 +133,7 @@ namespace WD7UVN_HFT_2023241.Client public static void Employee() { - foreach (Employee c in RestService.Get("/api/Employee")) + foreach (Employee c in RestService.Get("/api/Employee/")) { Console.WriteLine("Name: " + c.NAME); Console.WriteLine("ID: " + c.ID); @@ -148,7 +148,7 @@ namespace WD7UVN_HFT_2023241.Client public static void Service() { - foreach (Service c in RestService.Get("/api/Service")) + foreach (Service c in RestService.Get("/api/Service/")) { Console.WriteLine("Name: " + c.NAME); Console.WriteLine("ID: " + c.ID); @@ -166,7 +166,7 @@ namespace WD7UVN_HFT_2023241.Client public static void MaintainerTeam() { - foreach (MaintainerTeam c in RestService.Get("/api/MaintainerTeam")) + foreach (MaintainerTeam c in RestService.Get("/api/MaintainerTeam/")) { Console.WriteLine("Name: " + c.NAME); Console.WriteLine("ID: " + c.ID); @@ -210,7 +210,7 @@ namespace WD7UVN_HFT_2023241.Client SERVICE_ID = service_id }; - RestService.Put(c, "/api/Customer"); + RestService.Put(c, "/api/Customer/"); break; } @@ -256,7 +256,7 @@ namespace WD7UVN_HFT_2023241.Client MANAGER_ID = manager_id }; - RestService.Put(c, "/api/Employee"); + RestService.Put(c, "/api/Employee/"); break; } @@ -314,7 +314,7 @@ namespace WD7UVN_HFT_2023241.Client VERSION = version }; - RestService.Put(c, "/api/Service"); + RestService.Put(c, "/api/Service/"); break; } @@ -352,7 +352,7 @@ namespace WD7UVN_HFT_2023241.Client EMAIL = email }; - RestService.Put(c, "/api/MaintainerTeam"); + RestService.Put(c, "/api/MaintainerTeam/"); break; } @@ -418,7 +418,7 @@ namespace WD7UVN_HFT_2023241.Client SERVICE_ID = service_id }; - RestService.Post(c, "/api/Customer"); + RestService.Post(c, "/api/Customer/"); break; } catch (FormatException) @@ -486,7 +486,7 @@ namespace WD7UVN_HFT_2023241.Client MAINTAINER_ID = maintainer_id }; - RestService.Post(c, "/api/Employee"); + RestService.Post(c, "/api/Employee/"); break; } catch (FormatException) @@ -568,7 +568,7 @@ namespace WD7UVN_HFT_2023241.Client VERSION = version }; - RestService.Post(c, "/api/Service"); + RestService.Post(c, "/api/Service/"); break; } catch (FormatException) @@ -626,7 +626,7 @@ namespace WD7UVN_HFT_2023241.Client EMAIL = email }; - RestService.Post(c, "/api/MaintainerTeam"); + RestService.Post(c, "/api/MaintainerTeam/"); break; } catch (FormatException) diff --git a/WD7UVN_HFT_2023241.Client/Program.cs b/WD7UVN_HFT_2023241.Client/Program.cs index c9d7e2d..e708cfd 100644 --- a/WD7UVN_HFT_2023241.Client/Program.cs +++ b/WD7UVN_HFT_2023241.Client/Program.cs @@ -9,6 +9,7 @@ namespace WD7UVN_HFT_2023241.Client static void Main(string[] args) { + rest = new RestService(); ActionMenuHandler(); } diff --git a/WD7UVN_HFT_2023241.Client/RestService.cs b/WD7UVN_HFT_2023241.Client/RestService.cs index 6cc097c..3221166 100644 --- a/WD7UVN_HFT_2023241.Client/RestService.cs +++ b/WD7UVN_HFT_2023241.Client/RestService.cs @@ -101,7 +101,7 @@ namespace WD7UVN_HFT_2023241.Client public static T Get(int id, string endpoint) { T item = default(T); - HttpResponseMessage response = client.GetAsync(endpoint + "/" + id.ToString()).GetAwaiter().GetResult(); + HttpResponseMessage response = client.GetAsync(endpoint + id.ToString()).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { item = response.Content.ReadAsAsync().GetAwaiter().GetResult(); @@ -130,7 +130,7 @@ namespace WD7UVN_HFT_2023241.Client public static void Delete(int id, string endpoint) { HttpResponseMessage response = - client.DeleteAsync(endpoint + "/" + id.ToString()).GetAwaiter().GetResult(); + client.DeleteAsync(endpoint + id.ToString()).GetAwaiter().GetResult(); if (!response.IsSuccessStatusCode) {