36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Components.Authorization;
|
|
using SytelineSaAppEfDataModel.Dtos;
|
|
|
|
namespace OrdersManagement.Services;
|
|
|
|
public class CustomerOrderService(
|
|
IHttpClientFactory httpClientFactory,
|
|
AuthenticationStateProvider authenticationStateProvider)
|
|
: ServiceBase<CustomerOrderDto>(httpClientFactory, authenticationStateProvider)
|
|
{
|
|
public async Task<IEnumerable<CustomerOrderDto>?> GetCustomerOrdersAsync()
|
|
{
|
|
try
|
|
{
|
|
return await GetListAsync("api/CustomerOrders");
|
|
}
|
|
catch (HttpRequestException ex)
|
|
{
|
|
Console.WriteLine($"Błąd HTTP w GetCustomerOrdersAsync: {ex.Message}");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public async Task<CustomerOrderDto?> GetCustomerOrderAsync(Guid customerOrderNumber)
|
|
{
|
|
try
|
|
{
|
|
return await GetByIdAsync($"api/CustomerOrders/by-order-number/?customerOrderNumber={customerOrderNumber}");
|
|
}
|
|
catch (HttpRequestException ex)
|
|
{
|
|
Console.WriteLine($"Błąd HTTP w GetScheduleOrderAsync: {ex.Message}");
|
|
return null;
|
|
}
|
|
}
|
|
} |