Files
FA_WEB/OrdersManagement/Services/EdiCustomerOrderTranslateService.cs

29 lines
1.1 KiB
C#

using SytelineSaAppEfDataModel.Dtos;
namespace OrdersManagement.Services;
public class EdiCustomerOrderTranslateService(
IHttpClientFactory httpClientFactory,
CustomAuthenticationStateProvider authenticationStateProvider)
: ServiceBase<EdiCustomerOrderTranslateDto>(httpClientFactory, authenticationStateProvider)
{
public async Task<IEnumerable<EdiCustomerOrderTranslateDto>?> GetEdiCustomerOrdersTranslationsAsync()
{
try
{
return await GetListAsync("api/EdiCustomerOrdersTranslations");
}
catch (HttpRequestException ex)
{
Console.WriteLine($"Błąd HTTP w GetEdiCustomerOrdersTranslationsAsync: {ex.Message}");
return null;
}
}
public async Task<int> DeleteEdiCustomerOrderTranslateAsync(EdiCustomerOrderTranslateDto ediCustomerOrderTranslateDto)
{
HttpResponseMessage responseMessage =
await DeleteAsync($"api/EdiCustomerOrdersTranslations/?id={ediCustomerOrderTranslateDto.Id}");
return responseMessage.IsSuccessStatusCode ? 1 : 0;
}
}