first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user