Пример #1
0
        public static QuestionModel GetQuestion(int questionId)
        {
            try
            {
                var question = SQLAdapter.GetQuestionById(questionId);

                //if (question.QuestionUser != null)
                //{
                //    var questionUser = SQLAdapter.GetUserById(question.QuestionUser.Id);
                //    question.QuestionUser = questionUser;
                //}

                //if (question.AnswerUser != null)
                //{
                //    var answerUser = SQLAdapter.GetUserById(question.AnswerUser.Id);
                //    question.AnswerUser = answerUser;
                //}

                return(ModelMapper.MapToQuestionModel(question));
            }
            catch (Exception e)
            {
                return(null);
            }
        }