private void CheckAnswer(object obj) { List <Question> listAnswers = new List <Question>(); string questions = string.Empty; string answers = string.Empty; string koeff = string.Empty; foreach (var quest in Questions) { listAnswers.Add(quest); questions += quest.QuestionId + ","; answers += quest.Answer + ","; var ans = _repo.GetTrueAnswer(quest); koeff += ans + ","; } var mark = _repo.CheckAnswer(listAnswers); MessageBox.Show($"Вы заработали {mark} баллов", "Оценка", MessageBoxButton.OK, MessageBoxImage.Information); var studProgress = new StudentProgress { StudentId = UserId, Mark = mark, TestId = _test.TestId, Questions = questions, Answers = answers, Koeff = koeff }; _repo.AddMark(studProgress); }