示例#1
0
        // Answer Repo
        public async Task <IEnumerable <Answer> > GetAnswersAsync(int id, AnswerParams questionParams)
        {
            // Gotta back for implementing orderby date after another migration
            var answers = _context.Answers
                          .Where(a => a.IsDeleted == false)
                          .Where(a => a.Question.Id == id)
                          .Include(a => a.AnsweredBy)
                          .AsQueryable();

            answers = TQuery.QuestionQuery(questionParams, answers);

            return(await answers.ToListAsync());
        }
示例#2
0
        // Question Repo
        public async Task <IEnumerable <Question> > GetQuestionsAsync(QuestionParams questionParams)
        {
            // Gotta back for implementing orderby date after another migration
            var questions = _context.Questions
                            .Where(a => a.IsDeleted == false)
                            .Include(a => a.Category)
                            .Include(q => q.QuestionBy)
                            .Include(q => q.Answers)
                            .AsQueryable();

            questions = TQuery.QuestionQuery(questionParams, questions);

            return(await questions.ToListAsync());
        }