private void CheckButton_Click(object sender, RoutedEventArgs e) { List <AnswerDTO> answers = new List <AnswerDTO>(); foreach (DisplayWord word in StackOfWords.Children) { AnswerViewModel answer = new AnswerViewModel() { Id = word.Question.Id, Language = word.Question.TranslateIntoLanguage, TopicId = word.Question.TopicId, Answer = word.TranslationBox.Text }; answers.Add(Mapper.MapAnswerDTO(answer)); } IEnumerable <AnswerDTO> correctAnswerDTOs = _topicService.Check(answers); List <AnswerViewModel> correctAnswers = new List <AnswerViewModel>(); foreach (AnswerDTO answer in correctAnswerDTOs) { correctAnswers.Add(Mapper.MapAnswer(answer)); } foreach (DisplayWord word in StackOfWords.Children) { AnswerViewModel answer = correctAnswers.Where(a => a.Id == word.Question.Id).FirstOrDefault(); if (answer != null) { word.DisplayImage(answer.IsCorrect); } else { word.DisplayImage(false); } word.DisableTranslation(); } ResultProgress.SetProgress(correctAnswers.Where(a => a.IsCorrect).Count() * 100 / correctAnswers.Count()); ResultProgress.Visibility = Visibility.Visible; }