fix : pagination avec Api
continuous-integration/drone/push Build is passing Details

Multiplayer_Php
Jeremy DUCOURTHIAL 1 year ago
parent b513054114
commit ca2f9f36a8

@ -47,12 +47,12 @@ public partial class Administrators
int page = ((e.Page - 1) * e.PageSize) / 10 + 1;
// Envoyez une requête à l'API pour récupérer les questions de la page actuelle
var response = await Http.GetFromJsonAsync<Administrator[]>(API.API_URL + "administrators/" + API.TOKEN + $"?page={page}");
var response = await Http.GetFromJsonAsync<Administrator[]>(API.API_URL + "all/administrators/" + API.TOKEN + "/" + page);
if (!e.CancellationToken.IsCancellationRequested && response != null)
{
administrators = new List<Administrator>(response); // an actual data for the current page
totalItem = administrators.Count;
totalItem = response[0].total_administrators;
}
}

@ -81,12 +81,12 @@ public partial class Chapters
int page = ((e.Page - 1) * e.PageSize) / 10 + 1;
// Envoyez une requête à l'API pour récupérer les questions de la page actuelle
var response = await Http.GetFromJsonAsync<Chapter[]>(API.API_URL + "chapters/" + API.TOKEN + $"?page={page}");
var response = await Http.GetFromJsonAsync<Chapter[]>(API.API_URL + "all/chapters/" + API.TOKEN + "/" + page);
if (!e.CancellationToken.IsCancellationRequested)
{
chapters = new List<Chapter>(response); // an actual data for the current page
totalChapter = chapters.Count;
totalChapter = response[0].total_chapters;
}
}
}

@ -82,12 +82,12 @@ public partial class Players
int page = ((e.Page - 1) * e.PageSize) / 10 + 1;
// Envoyez une requête à l'API pour récupérer les questions de la page actuelle
var response = await Http.GetFromJsonAsync<Player[]>(API.API_URL + "players/" + API.TOKEN + $"?page={page}");
var response = await Http.GetFromJsonAsync<Player[]>(API.API_URL + "all/players/" + API.TOKEN + "/" + page);
if (!e.CancellationToken.IsCancellationRequested)
{
players = new List<Player>(response); // an actual data for the current page
totalPlayer = players.Count;
totalPlayer = response[0].total_players; ;
}
}
}

@ -88,7 +88,7 @@ public partial class Questions
int page = ((e.Page - 1) * e.PageSize)/10 + 1;
// Envoyez une requête à l'API pour récupérer les questions de la page actuelle
var response = await Http.GetFromJsonAsync<Question[]>(API.API_URL + "questions/" + API.TOKEN + $"?page={page}");
var response = await Http.GetFromJsonAsync<Question[]>(API.API_URL + "all/questions/" + API.TOKEN + "/" + page);
if (!e.CancellationToken.IsCancellationRequested && response != null)
{
@ -101,7 +101,7 @@ public partial class Questions
}
questions = selectedQuestions;
totalQuestion = questions.Count;
totalQuestion = response[0].total_questions;
}
}

@ -5,5 +5,6 @@ public class Administrator
public int Id { get; set; }
public string Username { get; set; }
public string HashedPassword { get; set; }
public int total_administrators { get; set; }
}

@ -4,4 +4,5 @@ public class Chapter
{
public int Id { get; set; }
public string Name { get; set; }
public int total_chapters { get; set; }
}

@ -5,5 +5,5 @@ public class Player
public int Id { get; set; }
public string Nickname { get; set; }
public string HashedPassword { get; set; }
public int total_players { get; set; }
}

@ -17,6 +17,5 @@ public class Question
public int IdAnswerGood { get; set; }
public int A_id { get; set; }
public string A_content { get; set; }
public int total_questions { get; set;}
}

Loading…
Cancel
Save