示例#1
0
        public new static Expression <Func <UserOwnedQuestion, UserOwnedQuestionModel> > BuildModel()
        {
            var answerExp = AnswerModel.BuildUserOwnedModel();

            return(x => new UserOwnedQuestionModel()
            {
                UserId = x.QuizzardUserId,
                Id = x.Id,
                QuestionText = x.QuestionText,
                Answers = x.UserOwnedAnswers.AsQueryable().Select(z => answerExp.Invoke(z)),
                QuestionTypeId = x.QuestionTypeId,
                UserOwned = true,
                ArchivedOn = x.ArchivedOn
            });
        }
示例#2
0
        public static Expression <Func <Question, QuestionModel> > BuildModel()
        {
            var answerExpression = AnswerModel.BuildModel();

            return(x => new QuestionModel()
            {
                Id = x.Id,
                QuizId = x.QuizId,
                QuestionText = x.QuestionText,
                CreatedOn = x.CreatedOn,
                QuestionTypeId = x.QuestionTypeId,
                UserOwned = false,
                ArchivedOn = x.ArchivedOn,
                Answers = x.QuestionAnswers.AsQueryable().Select(z => answerExpression.Invoke(z))
            });
        }