fix : ajouter questions remarche
continuous-integration/drone/push Build is failing Details

Multiplayer_Php
Maxence GUITARD 1 year ago
parent a602557620
commit 45fde3b28f

@ -3,7 +3,7 @@
public class QuestionModel public class QuestionModel
{ {
public int Id { get; set; } public int Id { get; set; }
public required string Content { get; set; } public string Content { get; set; }
public int IdChapter { get; set; } public int IdChapter { get; set; }
public int IdAnswerGood { get; set; } public int IdAnswerGood { get; set; }
public int Difficulty { get; set; } public int Difficulty { get; set; }

@ -9,7 +9,7 @@ namespace Blazor.Pages.Questions
{ {
public partial class AddQuestion public partial class AddQuestion
{ {
private QuestionModel? questionModel; private QuestionModel questionModel = new();
public List<Chapter> chapters = new(); public List<Chapter> chapters = new();
@ -39,8 +39,8 @@ namespace Blazor.Pages.Questions
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var response = Http.GetFromJsonAsync<Chapter[]>(API.API_URL + "chapters/" + API.TOKEN).Result; var response = Http.GetFromJsonAsync<Chapter[]>(API.API_URL + "chapters/" + API.TOKEN).Result;
if (response == null) chapters = new List<Chapter>();
chapters = new List<Chapter>(response); else chapters = new List<Chapter>(response);
answerModels = new(); answerModels = new();
checkboxs = new(); checkboxs = new();
@ -50,13 +50,6 @@ namespace Blazor.Pages.Questions
checkboxs.Add(new Checkbox(i)); checkboxs.Add(new Checkbox(i));
} }
} }
protected override async Task OnInitializedAsync()
{
var response = Http.GetFromJsonAsync<Chapter[]>(API.API_URL + "chapters/" + API.TOKEN).Result;
if (response == null) chapters = new List<Chapter>();
else chapters = new List<Chapter>(response);
}
private async Task HandleValidSubmit() private async Task HandleValidSubmit()
{ {
if (questionModel != null) if (questionModel != null)
@ -80,7 +73,6 @@ namespace Blazor.Pages.Questions
} }
} }
var formContent = new FormUrlEncodedContent(formData); var formContent = new FormUrlEncodedContent(formData);
string apiUri = API.API_URL + "add/question/" + API.TOKEN; string apiUri = API.API_URL + "add/question/" + API.TOKEN;

Loading…
Cancel
Save