phronCare/phronCare.UIBlazor/Services/Sales/CustomerHttpService.cs

26 lines
850 B
C#
Raw Normal View History

2025-04-06 02:43:01 -03:00
using Domain.Entities;
using Domain.Generics;
using System.Net.Http.Json;
namespace phronCare.UIBlazor.Services.Sales
{
public class CustomerHttpService
{
private readonly HttpClient _http;
public CustomerHttpService(HttpClient http)
{
_http = http;
}
public async Task<PagedResult<ECustomer>?> SearchCustomersAsync(CustomerSearchParams searchParams)
{
2025-04-06 18:23:47 -03:00
var url = $"api/Customer/search?" +
2025-04-06 02:43:01 -03:00
$"name={searchParams.Name}&" +
$"email={searchParams.Email}&" +
$"document={searchParams.Document}&" +
$"page={searchParams.Page}&" +
$"pageSize={searchParams.PageSize}";
return await _http.GetFromJsonAsync<PagedResult<ECustomer>>(url);
}
}
}