private async void FuncToCall2(object context) { if (SelectedOption == null) { MessageBox.Show("Please choose an answer."); return; } if (SelectedOption.OptionText == (SelectedTest.Questions.ToList())[CurrentQuestion].CorrectAnswer) { TotalTestMark += (SelectedTest.Questions.ToList())[CurrentQuestion].QuestionMark; } CurrentQuestion++; if (CurrentQuestion <= SelectedTest.Questions.Count() - 1) { _ = UpdateQuestion(); } else { ListVisibility = Visibility.Visible; DescriptionVisibility = Visibility.Visible; MainVisibility = Visibility.Collapsed; CreateQuestionVisibility = Visibility.Visible; CurrentQuestion = 0; TestResult newTestResult = new TestResult() { Mark = TotalTestMark * 100 / SelectedTest.TotalMark }; ITestResultService service = new TestResultService(); await service.CreatePersonalTestResult(CurrentAccount.Id, SelectedTest.TestName, newTestResult); } }