25 lines
829 B
C#
25 lines
829 B
C#
using FaKrosnoEfDataModel.Dtos;
|
|
|
|
namespace OrdersManagement.Services;
|
|
|
|
public class ProductService(IHttpClientFactory httpClientFactory, CustomAuthenticationStateProvider authenticationStateProvider)
|
|
: ServiceBase<ProductDto>(httpClientFactory, authenticationStateProvider)
|
|
{
|
|
public async Task<IEnumerable<ProductDto>?> GetProductsByIndexAsync(string indexName)
|
|
{
|
|
try
|
|
{
|
|
return await GetListAsync($"api/Product/by-index?indexName={indexName}");
|
|
}
|
|
catch (HttpRequestException ex)
|
|
{
|
|
Console.WriteLine($"Błąd HTTP w GetProductsByIndexAsync: {ex.Message}");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public async Task<HttpResponseMessage> UpdateProductAsync(ProductDto product)
|
|
{
|
|
return await PutAsJsonAsync("api/Product", product);
|
|
}
|
|
} |