public static LastCommentViewModel ConvertToLastCommentViewModel(LatestCommentDTO lastCommentDTO) { if (lastCommentDTO == null) { throw new ArgumentNullException(); } return(new LastCommentViewModel { PostId = lastCommentDTO.PostId, PostTitle = lastCommentDTO.PostTitle, CommentId = lastCommentDTO.CommentId, AuthorFirstName = lastCommentDTO.AuthorFirstName, AuthorLastName = lastCommentDTO.AuthorLastName, CommentContent = lastCommentDTO.Content, CreatedDate = lastCommentDTO.CreatedDate }); }
public static LatestCommentDTO ConvertToLatestCommentDTO(Comment comment) { if (comment == null) { throw new ArgumentNullException(nameof(comment)); } var commentDTO = new LatestCommentDTO { PostId = comment.PostId, PostTitle = comment.Post.Title, CommentId = comment.Id, Content = comment.Content, AuthorFirstName = comment.User.FirstName, AuthorLastName = comment.User.LastName, CreatedDate = comment.CreatedDate }; return(commentDTO); }