Files
2026-03-22 00:29:34 +01:00

25 lines
702 B
C#

using BethanysPieShopHRM.Shared.Domain;
using System.Net.Http.Json;
namespace Webshop.App.Services
{
public class CountryDataService : ICountryDataService
{
private readonly HttpClient _httpClient;
public CountryDataService(
HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<IEnumerable<Country>> GetCountries() {
return await _httpClient.GetFromJsonAsync<IEnumerable<Country>>("/api/country");
}
public async Task<Country> GetCountryById(int countryId)
{
return await _httpClient.GetFromJsonAsync<Country>($"/api/country/{countryId}");
}
}
}