|
|
@ -9,7 +9,7 @@ namespace Blazor.Pages.Questions
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public partial class AddQuestion
|
|
|
|
public partial class AddQuestion
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private QuestionModel questionModel = new();
|
|
|
|
private QuestionModel? questionModel;
|
|
|
|
|
|
|
|
|
|
|
|
public List<Chapter> chapters = new();
|
|
|
|
public List<Chapter> chapters = new();
|
|
|
|
|
|
|
|
|
|
|
@ -50,12 +50,13 @@ 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private async void HandleValidSubmit()
|
|
|
|
private async void HandleValidSubmit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (questionModel != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
await DataService.Add(questionModel);
|
|
|
|
await DataService.Add(questionModel);
|
|
|
|
|
|
|
|
|
|
|
|
var formData = new List<KeyValuePair<string, string>>();
|
|
|
|
var formData = new List<KeyValuePair<string, string>>();
|
|
|
@ -97,3 +98,4 @@ namespace Blazor.Pages.Questions
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|