|
|
|
@ -27,10 +27,8 @@ namespace Blazor.Services
|
|
|
|
|
public async Task<Chapter> GetById(int id)
|
|
|
|
|
{
|
|
|
|
|
// Get the current data
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Chapter>>(API.API_URL+"chapters/"+API.TOKEN).Result;
|
|
|
|
|
|
|
|
|
|
// Get the chapter int the list
|
|
|
|
|
var chapter = currentData.FirstOrDefault(w => w.Id == id);
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Chapter>>(API.API_URL + "chapters/" + id + "/" + API.TOKEN).Result;
|
|
|
|
|
var chapter = currentData[0];
|
|
|
|
|
|
|
|
|
|
// Check if chapter exist
|
|
|
|
|
if (chapter == null)
|
|
|
|
@ -134,10 +132,8 @@ namespace Blazor.Services
|
|
|
|
|
public async Task<Administrator> GetAdminById(int id)
|
|
|
|
|
{
|
|
|
|
|
// Get the current data
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Administrator>>(API.API_URL+"administrators/"+API.TOKEN).Result;
|
|
|
|
|
|
|
|
|
|
// Get the admin int the list
|
|
|
|
|
var admin = currentData.FirstOrDefault(w => w.Id == id);
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Administrator>>(API.API_URL + "administrators/" + id + "/" + API.TOKEN).Result;
|
|
|
|
|
var admin = currentData[0];
|
|
|
|
|
|
|
|
|
|
// Check if admin exist
|
|
|
|
|
if (admin == null)
|
|
|
|
@ -227,7 +223,7 @@ namespace Blazor.Services
|
|
|
|
|
public async Task<Question> GetQuestionById(int id)
|
|
|
|
|
{
|
|
|
|
|
// Get the current data
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Question>>(API.API_URL+"questions/"+API.TOKEN).Result;
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Question>>(API.API_URL + "questions/"+API.TOKEN).Result;
|
|
|
|
|
|
|
|
|
|
// Get the question int the list
|
|
|
|
|
var question = currentData.FirstOrDefault(w => w.Id == id);
|
|
|
|
@ -336,10 +332,8 @@ namespace Blazor.Services
|
|
|
|
|
public async Task<Player> GetPlayerById(int id)
|
|
|
|
|
{
|
|
|
|
|
// Get the current data
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Player>>(API.API_URL+"players/"+API.TOKEN).Result;
|
|
|
|
|
|
|
|
|
|
// Get the player in the list
|
|
|
|
|
var player = currentData.FirstOrDefault(w => w.Id == id);
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Player>>(API.API_URL + "players/" + id + "/" + API.TOKEN).Result;
|
|
|
|
|
var player = currentData[0];
|
|
|
|
|
|
|
|
|
|
// Check if player exist
|
|
|
|
|
if (player == null)
|
|
|
|
@ -428,10 +422,7 @@ namespace Blazor.Services
|
|
|
|
|
public async Task<Answer> GetAnswerByIdQuestion(int id)
|
|
|
|
|
{
|
|
|
|
|
// Get the current data
|
|
|
|
|
var currentData = _http.GetFromJsonAsync<List<Answer>>(API.API_URL + "answer/" + API.TOKEN).Result;
|
|
|
|
|
|
|
|
|
|
// Get the question int the list
|
|
|
|
|
var answer = currentData.FirstOrDefault(w => w.Id == id);
|
|
|
|
|
var answer = _http.GetFromJsonAsync<Answer>(API.API_URL + "answer/" + id + "/" + API.TOKEN).Result;
|
|
|
|
|
|
|
|
|
|
// Check if question exist
|
|
|
|
|
if (answer == null)
|
|
|
|
|