예제 #1
0
        public AnswerModel GetAnswerById(int id)
        {
            AnswerModel instance = null;

            foreach (QuestionModel question in Questions)
            {
                foreach (AnswerModel answer in question.Answers)
                {
                    if (id.Equals(answer.Id))
                    {
                        instance = answer;
                        break;
                    }
                }
            }
            return(instance);
        }
예제 #2
0
        private void RemoveCommentFrom(int id)
        {
            CommentModel instance = null;

            foreach (QuestionModel question in Questions)
            {
                if (question.GetCommentById(id) != null)
                {
                    instance = question.GetCommentById(id);
                    question.DeleteComment(instance);
                    break;
                }

                foreach (AnswerModel answer in question.Answers)
                {
                    if (answer.GetCommentById(id) != null)
                    {
                        instance = answer.GetCommentById(id);
                        answer.DeleteComment(instance);
                        break;
                    }
                }
            }
        }