예제 #1
0
        /// <summary>
        /// 删除问题选项
        /// </summary>
        /// <param name="questionOptionGuid"></param>
        public void RemoveQuestionOption(Guid questionOptionGuid)
        {
            if (QuestionOptions == null)
            {
                throw new Exception($"问题选项{questionOptionGuid}不存在!");
            }
            var qOption = QuestionOptions.FirstOrDefault(p => p.QuestionOptionGuid.Equals(questionOptionGuid));

            if (qOption == null)
            {
                throw new Exception($"问题选项{questionOptionGuid}不存在!");
            }

            QuestionOptions.Remove(qOption);
            if (qOption.QuestionOptionGuid.Equals(CorrectOptionId))
            {
                CorrectOptionId = default(Guid);
                CorrectOption   = null;
            }
        }
예제 #2
0
 public void DeleteQuestionOption(QuestionOptionViewModel questionOptionViewModel)
 {
     QuestionOptions.Remove(questionOptionViewModel);
     questionOptionViewModel.Delete();
     RaisePropertyChanged("QuestionOptions");
 }