コード例 #1
0
ファイル: APIModelDataMapper.cs プロジェクト: dashluu/Blog
        public PostDTO MapEditedPostModelToDTO(APIEditedPostModel editedPostModel)
        {
            if (editedPostModel == null)
            {
                return(null);
            }

            PostDTO postDTO = new PostDTO()
            {
                Title             = editedPostModel.Title,
                PostCategory      = MapPostCategoryModelToDTO(editedPostModel.PostCategory),
                ThumbnailImageSrc = editedPostModel.ThumbnailImageSrc,
                ShortDescription  = editedPostModel.ShortDescription,
                Content           = editedPostModel.Content
            };

            return(postDTO);
        }
コード例 #2
0
        public PostModelWithPaginatedComments MapPostDTOToModelWithPaginatedComments(PostDTOWithPaginatedComments postDTOWithPaginatedComments)
        {
            if (postDTOWithPaginatedComments == null)
            {
                return(null);
            }

            PostDTO postDTO = postDTOWithPaginatedComments.Post;
            PaginationDTO <CommentDTO> commentPaginationDTO = postDTOWithPaginatedComments.CommentPaginationDTO;

            PostModelWithPaginatedComments postModelWithPaginatedComments = new PostModelWithPaginatedComments()
            {
                Post = MapPostDTOToModel(postDTO),
                CommentPaginationModel = MapCommentPaginationDTOToModel(commentPaginationDTO)
            };

            return(postModelWithPaginatedComments);
        }
コード例 #3
0
ファイル: APIModelDataMapper.cs プロジェクト: dashluu/Blog
        public APIEditedPostModel MapEditedPostDTOToModel(PostDTO postDTO)
        {
            if (postDTO == null)
            {
                return(null);
            }

            APIEditedPostModel editedPostModel = new APIEditedPostModel()
            {
                Title             = postDTO.Title,
                PostCategory      = MapPostCategoryDTOToModel(postDTO.PostCategory),
                ThumbnailImageSrc = postDTO.ThumbnailImageSrc,
                ShortDescription  = postDTO.ShortDescription,
                Content           = postDTO.Content
            };

            return(editedPostModel);
        }