コード例 #1
0
        public Question DeleteQuestion(string id)
        {
            var question = GetQuestionById(id);
            var deleted  = _repo.DeleteQuestion(id);

            if (!deleted)
            {
                throw new Exception($"Unable to remove Question ID: {id}");
            }
            return(question);
        }
コード例 #2
0
        public Question DeleteQuestion(string id)
        {
            var question = GetQuestionById(id);

            if (question.AnswerId != null)
            {
                throw new Exception("Answered Questions cannot be deleted");
            }
            var deleted = _repo.DeleteQuestion(id);

            if (!deleted)
            {
                throw new Exception($"Could not delete question with ID {id}");
            }
            return(question);
        }
コード例 #3
0
 public String DeleteQuestion(int Id)
 {
     return(_repo.DeleteQuestion(Id));
 }