Пример #1
0
        // Getting all questions on the Home Page
        public PagedResultDto <QuestionDto> GetQuestions(GetQuestionsInput input)
        {
            var questionCount = _questionRepository.Count();
            var questions     = _questionRepository
                                .GetAll()
                                .Include(q => q.CreatorUser)
                                .OrderBy(q => q.CreationTime)
                                .ToList();

            return(new PagedResultDto <QuestionDto>
            {
                TotalCount = questionCount,
                Items = questions.MapTo <List <QuestionDto> >()
            });
        }
Пример #2
0
        public PagedResultOutput <QuestionDto> GetQuestions(GetQuestionsInput input)
        {
            if (input.MaxResultCount <= 0)
            {
                input.MaxResultCount = SettingManager.GetSettingValue <int>(MySettingProvider.QuestionsDefaultPageSize);
            }

            var questionCount = _questionRepository.Count();
            var questions     =
                _questionRepository
                .GetAll()
                .Include(q => q.CreatorUser)
                .OrderBy(input.Sorting)
                .PageBy(input)
                .ToList();

            return(new PagedResultOutput <QuestionDto>
            {
                TotalCount = questionCount,
                Items = questions.MapTo <List <QuestionDto> >()
            });
        }