master
enjolys 3 years ago
parent f157bdead5
commit 866b8f7a13

@ -149,7 +149,7 @@ namespace Minecraft.Crafting.Api.Controllers
[Route("")]
public Task<List<Item>> List(int currentPage, int pageSize)
{
var data = JsonSerializer.Deserialize<List<Item>>(System.IO.File.ReadAllText("Data/items.json"), _jsonSerializerOptions);
var data = JsonSerializer.Deserialize<List<Musique>>(System.IO.File.ReadAllText("Data/items.json"), _jsonSerializerOptions);
return Task.FromResult(data.Skip((currentPage - 1) * pageSize).Take(pageSize).ToList());
}

@ -19,5 +19,10 @@ namespace ProjetBlazor.Services
// Save the data
await _http.PostAsJsonAsync("https://localhost:7234/api/", musique);
}
public Task<List<Musique>> List(int currentPage, int pageSize)
{
return await _http.GetFromJsonAsync<List<Musique>>($"https://localhost:7234/api/Crafting/?currentPage={currentPage}&pageSize={pageSize}");
}
}
}

@ -5,5 +5,7 @@ namespace ProjetBlazor.Services
public interface IDataService
{
Task AddInPlaylist(Musique musique);
Task<List<Musique>> List(int currentPage, int pageSize);
}
}

Loading…
Cancel
Save