// 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> >() }); }
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> >() }); }