in src/Relecloud.Web.CallCenter/Services/RelecloudApiServices/RelecloudApiConcertService.cs [86:107]
public async Task<DeleteResult> DeleteConcertAsync(int id)
{
await PrepareAuthenticatedClient();
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, $"api/Concert/{id}");
var httpResponseMessage = await this.httpClient.SendAsync(httpRequestMessage);
if (httpResponseMessage.StatusCode == HttpStatusCode.BadRequest)
{
var responseMessage = await httpResponseMessage.Content.ReadAsStringAsync();
var failedCreateOperation = JsonSerializer.Deserialize<DeleteResult>(responseMessage, RelecloudApiConfiguration.GetSerializerOptions());
return failedCreateOperation ?? throw new InvalidOperationException("Failed to parse response");
}
else if (httpResponseMessage.StatusCode != HttpStatusCode.OK)
{
throw new InvalidOperationException(nameof(DeleteConcertAsync), new WebException(await httpResponseMessage.Content.ReadAsStringAsync()));
}
return new DeleteResult
{
Success = true
};
}