Changeset 8b6791f for src/FinkiChattery/FinkiChattery.Api/ApplicationServices/Questioning/Mapper/QuestionMapper.cs
- Timestamp:
- 10/22/21 21:47:17 (3 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/FinkiChattery/FinkiChattery.Api/ApplicationServices/Questioning/Mapper/QuestionMapper.cs
r81c2e6f r8b6791f 1 1 #nullable enable 2 2 3 using FinkiChattery.Contracts.Questioning .GetQuestionState;3 using FinkiChattery.Contracts.Questioning; 4 4 using FinkiChattery.Persistence.Repositories.Contracts; 5 5 using System.Collections.Generic; … … 10 10 public static class QuestionMapper 11 11 { 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 12 34 public static QuestionStateResponse ToQuestionStateResponse(this QuestionStateDto questionState) 13 35 {
Note:
See TracChangeset
for help on using the changeset viewer.