public CommentVM GetIssueCommentVM(int currentUserId, Comment item) { var commentVM = new CommentVM { ID = item.ID, CommentBody = item.CommentText, AuthorName = item.Author.FirstName, CreativeDate = item.CreatedDate }; commentVM.CommentBody = commentVM.CommentBody.ConvertUrlsToLinks(); commentVM.AvatarHash = UserService.GetAvatarUrl(item.Author.Avatar, 42); commentVM.CreatedDateRelative = item.CreatedDate.ToJSONFriendlyDateTime();//.ToRelativeDateTime(); commentVM.IsOwner = item.CreatedByID == currentUserId; return(commentVM); }
public CommentVM GetCommentVM(int commentId) { var commentVM = new CommentVM(); var comment = repo.GetComment(commentId); if (comment != null) { commentVM.ID = comment.ID; commentVM.AuthorName = comment.Author.FirstName; commentVM.CommentBody = comment.CommentText.ConvertUrlsToLinks(); commentVM.CreativeDate = comment.CreatedDate; commentVM.AvatarHash = UserService.GetAvatarUrl(comment.Author.Avatar, 42); commentVM.CreatedDateRelative = comment.CreatedDate.ToShortDateString(); //.ToRelativeDateTime(); } return(commentVM); }