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