All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 5m41s
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using Domain.Entities;
|
|
using Domain.Generics;
|
|
using System.Net.Http.Json;
|
|
namespace phronCare.UIBlazor.Services.Sales
|
|
{
|
|
public class CustomerService
|
|
{
|
|
private readonly HttpClient _http;
|
|
public CustomerService(HttpClient http)
|
|
{
|
|
_http = http;
|
|
}
|
|
public async Task<PagedResult<ECustomer>?> SearchCustomersAsync(CustomerSearchParams searchParams)
|
|
{
|
|
var url = $"api/Customer/search?" +
|
|
$"name={searchParams.Name}&" +
|
|
$"email={searchParams.Email}&" +
|
|
$"document={searchParams.Document}&" +
|
|
$"page={searchParams.Page}&" +
|
|
$"pageSize={searchParams.PageSize}";
|
|
return await _http.GetFromJsonAsync<PagedResult<ECustomer>>(url);
|
|
}
|
|
}
|
|
public class CustomerSearchParams
|
|
{
|
|
public string? Name { get; set; }
|
|
public string? Email { get; set; }
|
|
public string? Document { get; set; }
|
|
public int Page { get; set; } = 1;
|
|
public int PageSize { get; set; } = 10;
|
|
}
|
|
}
|