* Added maintaining Products

* Extended DataModels
* Extended API
This commit is contained in:
2025-03-29 21:37:36 +01:00
parent 15b0060c50
commit 0eaf941021
13 changed files with 237 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
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);
}
}