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