* Added maintaining Products
* Extended DataModels * Extended API
This commit is contained in:
25
OrdersManagement/Services/ProductService.cs
Normal file
25
OrdersManagement/Services/ProductService.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user