Ignore:
Timestamp:
10/22/21 21:47:17 (3 years ago)
Author:
Стојков Марко <mst@…>
Branches:
dev
Children:
466d1ac, 5ad5988
Parents:
81c2e6f (diff), 70e04f1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merged feature/preview-questions-and-search into dev

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/FinkiChattery/FinkiChattery.Api/ApplicationServices/Questioning/Mapper/QuestionMapper.cs

    r81c2e6f r8b6791f  
    11#nullable enable
    22
    3 using FinkiChattery.Contracts.Questioning.GetQuestionState;
     3using FinkiChattery.Contracts.Questioning;
    44using FinkiChattery.Persistence.Repositories.Contracts;
    55using System.Collections.Generic;
     
    1010    public static class QuestionMapper
    1111    {
     12        public static List<PreviewQuestionResponse> ToPreviewQuestionsResponse(this IEnumerable<QuestionPreviewDto> questions)
     13        {
     14            var questionsResponse = new List<PreviewQuestionResponse>();
     15
     16            if (questions.Any())
     17            {
     18                questionsResponse = questions.Select(x =>
     19                {
     20                    var questionCategoriesResponse = new List<PreviewQuestionCategoryResponse>();
     21
     22                    if (x.Categories.Any())
     23                    {
     24                        questionCategoriesResponse = x.Categories.Select(y => new PreviewQuestionCategoryResponse(y.Id, y.Uid, y.Text)).ToList();
     25                    }
     26
     27                    return new PreviewQuestionResponse(x.Id, x.Uid, x.Title, x.Views, x.AnswersCount, x.CreatedOn, questionCategoriesResponse);
     28                }).ToList();
     29            }
     30
     31            return questionsResponse;
     32        }
     33
    1234        public static QuestionStateResponse ToQuestionStateResponse(this QuestionStateDto questionState)
    1335        {
Note: See TracChangeset for help on using the changeset viewer.