|
|
|
@ -47,11 +47,6 @@ namespace Blazor.Pages.Questions
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetCorrectAnswer(int Id)
|
|
|
|
|
{
|
|
|
|
|
questionModel.IdAnswerGood = Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
|
|
|
|
var response = Http.GetFromJsonAsync<Chapter[]>($"https://trusting-panini.87-106-126-109.plesk.page/api/chapters/qUOGkWdoPCgbmuqxIC8xiaX0rV1Pw1LoPafkaoHOgszEyD9P2vcOu493xCDZpAqO").Result;
|
|
|
|
@ -64,19 +59,25 @@ namespace Blazor.Pages.Questions
|
|
|
|
|
await DataService.Add(questionModel);
|
|
|
|
|
|
|
|
|
|
var formData = new List<KeyValuePair<string, string>>();
|
|
|
|
|
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>("content", questionModel.Content));
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>("chapter", questionModel.IdChapter.ToString()));
|
|
|
|
|
for (int i = 0; i < answerModels.Count; i++)
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>("idchapter", questionModel.IdChapter.ToString()));
|
|
|
|
|
foreach (var answerModel in answerModels)
|
|
|
|
|
{
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>($"answercontent{i + 1}", answerModels[i].Content));
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>($"answercontent{answerModel.Id+1}", answerModel.Content));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>("idanswergood", questionModel.IdAnswerGood.ToString()));
|
|
|
|
|
|
|
|
|
|
foreach (var checkbox in checkboxs)
|
|
|
|
|
{
|
|
|
|
|
if (checkbox.IsCorrect == true)
|
|
|
|
|
{
|
|
|
|
|
var idgood = checkbox.Id + 1;
|
|
|
|
|
formData.Add(new KeyValuePair<string, string>("idanswergood", idgood.ToString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var formContent = new FormUrlEncodedContent(formData);
|
|
|
|
|
|
|
|
|
|
string apiUri = API.API_URL+"add/administrator/"+API.TOKEN;
|
|
|
|
|
string apiUri = API.API_URL+"add/question/"+API.TOKEN;
|
|
|
|
|
|
|
|
|
|
using (var httpClient = new HttpClient())
|
|
|
|
|
{
|
|
|
|
|