Пример #1
0
        public async Task <IEnumerable <Answer> > GetAnswersAsync(Guid questionId, int from, int toTake)
        {
            ThrowIfDisposed();
            QuestionEntity question = await QuestionRepository.GetQuestionAsync(questionId, CancellationToken);

            if (question == null || question.IsClosed || !question.IsVerified)
            {
                return(Enumerable.Empty <Answer>());
            }

            AnswerFilter filter = new AnswerFilter()
            {
                QuestionId = questionId,
                From       = from,
                ToTake     = toTake
            };

            IEnumerable <AnswerEntity> answers = await AnswerRepository.GetAnswersAsync(filter, CancellationToken);

            var answersResult = Mapper.Map <IEnumerable <AnswerEntity>, IEnumerable <Answer> >(answers);

            return(answersResult);
        }