You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
785 B

using ProjetBlazor.Modeles;
namespace ProjetBlazor.Services
{
public class DataApiService : IDataService
{
private readonly HttpClient _http;
public DataApiService(HttpClient http)
{
_http = http;
}
public async Task Add(Musique musique)
{
// Get the item
//var item = ItemFactory.Create(model);
// Save the data
await _http.PostAsJsonAsync("https://localhost:7234/api/controleur/", musique);
}
public async Task<List<Musique>> List(int currentPage, int pageSize)
{
return await _http.GetFromJsonAsync<List<Musique>>($"https://localhost:7234/api/controleur/?currentPage={currentPage}&pageSize={pageSize}");
}
}
}