public CommentContentViewModel CreateComment(CommentDTO source, UserProfile author) { try { source.CreationTime = source.CreationTime.ToLocalTime(); CommentContentViewModel commentResult = BuildCommentWithoutAuthorDetails( source, author.DisplayName, (author.Avatar?.Url != null) ? string.Format(GlobalSettings.Instance.Endpoints.MediaEndPoints.GetMediaEndPoints, author.Avatar?.Url) : null); return(commentResult); } catch (Exception exc) { Debugger.Break(); throw new InvalidOperationException(_BUILD_COMMENT_ERROR, exc); } }
public ObservableCollection <CommentContentViewModel> CreateComments(IEnumerable <CommentDTO> source) { try { ObservableCollection <CommentContentViewModel> comments = new ObservableCollection <CommentContentViewModel>(); foreach (CommentDTO comment in source) { CommentContentViewModel commentResult = BuildCommentWithoutAuthorDetails( comment, comment.Author.DisplayName, (comment.Author.Avatar?.Url != null) ? string.Format(GlobalSettings.Instance.Endpoints.MediaEndPoints.GetMediaEndPoints, comment.Author.Avatar?.Url) : null); comments.Add(commentResult); } return(comments); } catch (Exception exc) { Debugger.Break(); throw new InvalidOperationException(_BUILD_COMMENT_ERROR, exc); } }