private void DeleteAnswer() { if (SelectedAnswer == null) { return; } Question.AnswerSetValues.Remove(SelectedAnswer); AnswerSetValues.Remove(SelectedAnswer); }
private void AddExistingAnswer() { if (SelectedExistingAnswer == null) { return; } if (Question.AnswerSetValues.Any(value => value.Value.Equals(SelectedExistingAnswer.Value))) { return; } Question.AnswerSetValues.Add(SelectedExistingAnswer); AnswerSetValues.Add(SelectedExistingAnswer); SelectedAnswer = SelectedExistingAnswer; }
private void AddNewAnswer() { if (string.IsNullOrWhiteSpace(NewAnswerText)) { return; } NewAnswerText = NewAnswerText.Trim(); if (Question.AnswerSetValues.Any(value => value.Value.Equals(NewAnswerText))) { return; } var newAnswer = new AnswerSetValue { Value = NewAnswerText }; Question.AnswerSetValues.Add(newAnswer); AnswerSetValues.Add(newAnswer); SelectedAnswer = newAnswer; }