Apparently HttpClient doesn't support sending a request body with DELETE. Fixing.

This commit is contained in:
TypoMustakes
2024-01-09 18:22:22 +01:00
parent 5e833934b7
commit a1665eab82
4 changed files with 12 additions and 8 deletions

View File

@@ -55,8 +55,9 @@ namespace WD7UVN_HFT_2023241.Endpoint
LogicServices.CRUDOperations.UpdateCustomer(e);
}
[HttpDelete()]
public void DeleteCustomer([FromBody] int id)
//HttpClient does not support sending data in the body of a DELETE request. Instead, we can send the data in the URL like with a GET request.
[HttpDelete("{id}")]
public void DeleteCustomer(int id)
{
LogicServices.CRUDOperations.DeleteCustomer(id);
}

View File

@@ -55,8 +55,9 @@ namespace WD7UVN_HFT_2023241.Endpoint
LogicServices.CRUDOperations.UpdateEmployee(e);
}
[HttpDelete()]
public void DeleteEmployee([FromBody] int id)
//HttpClient does not support sending data in the body of a DELETE request. Instead, we can send the data in the URL like with a GET request.
[HttpDelete("{id}")]
public void DeleteEmployee(int id)
{
LogicServices.CRUDOperations.DeleteEmployee(id);
}

View File

@@ -55,8 +55,9 @@ namespace WD7UVN_HFT_2023241.Endpoint
LogicServices.CRUDOperations.UpdateMaintainerTeam(e);
}
[HttpDelete()]
public void DeleteMaintainerTeam([FromBody] int id)
//HttpClient does not support sending data in the body of a DELETE request. Instead, we can send the data in the URL like with a GET request.
[HttpDelete("{id}")]
public void DeleteMaintainerTeam(int id)
{
LogicServices.CRUDOperations.DeleteMaintainerTeam(id);
}

View File

@@ -55,8 +55,9 @@ namespace WD7UVN_HFT_2023241.Endpoint
LogicServices.CRUDOperations.UpdateService(e);
}
[HttpDelete()]
public void DeleteService([FromBody] int id)
//HttpClient does not support sending data in the body of a DELETE request. Instead, we can send the data in the URL like with a GET request.
[HttpDelete("{id}")]
public void DeleteService(int id)
{
LogicServices.CRUDOperations.DeleteService(id);
}