Fixed an issue where the associated CRUD action of PUT and POST were switched up

This commit is contained in:
2024-04-29 22:58:18 +02:00
parent 4bffe13579
commit f99350a329

View File

@@ -157,7 +157,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
public async Task PostAsync<T>(T item, string endpoint) public async Task PostAsync<T>(T item, string endpoint)
{ {
HttpResponseMessage response = HttpResponseMessage response =
await client.PostAsJsonAsync(endpoint, item); await client.PostAsJsonAsync("api/" + endpoint, item);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
@@ -211,7 +211,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
public async Task PutAsync<T>(T item, string endpoint) public async Task PutAsync<T>(T item, string endpoint)
{ {
HttpResponseMessage response = HttpResponseMessage response =
await client.PutAsJsonAsync(endpoint, item); await client.PutAsJsonAsync("api/" + endpoint, item);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
@@ -357,11 +357,11 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
{ {
if (hasSignalR) if (hasSignalR)
{ {
this.rest.PostAsync(item, typeof(T).Name); this.rest.PutAsync(item, typeof(T).Name);
} }
else else
{ {
this.rest.PostAsync(item, typeof(T).Name).ContinueWith((t) => this.rest.PutAsync(item, typeof(T).Name).ContinueWith((t) =>
{ {
Init().ContinueWith(z => Init().ContinueWith(z =>
{ {
@@ -379,11 +379,11 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
{ {
if (hasSignalR) if (hasSignalR)
{ {
this.rest.PutAsync(item, typeof(T).Name); this.rest.PostAsync(item, typeof(T).Name);
} }
else else
{ {
this.rest.PutAsync(item, typeof(T).Name).ContinueWith((t) => this.rest.PostAsync(item, typeof(T).Name).ContinueWith((t) =>
{ {
Init().ContinueWith(z => Init().ContinueWith(z =>
{ {