public Dictionary <string, string> ReadIncludedKeyValues(CommentInclusionConfiguration config, GetCommentModel model) { string[] keys = ReadIncludedKeys(config).ToArray(); string[] values = ReadIncludedValues(config, model).ToArray(); return(DictionaryUtil.KvpToDictionary(keys, values)); }
public IEnumerable <string> ReadIncludedKeys(CommentInclusionConfiguration config) { var keys = new List <string>(); if (config.IncludeId) { keys.Add(ID); } if (config.IncludeUserId) { keys.Add(USER_ID); } if (config.IncludeText) { keys.Add(TEXT); } if (config.IncludeUrl) { keys.Add(URL); } if (config.IncludeKarma) { keys.Add(KARMA); } if (config.IncludeCommentIds) { keys.Add(COMMENT_IDS); } if (config.IncludeParentCommentId) { keys.Add(PARENT_COMMENT_ID); } if (config.IncludeParentArticleId) { keys.Add(PARENT_ARTICLE_ID); } if (config.IncludeDeleted) { keys.Add(DELETED); } if (config.IncludeUsersLiked) { keys.Add(USERS_LIKED); } if (config.IncludeUsersDisliked) { keys.Add(USERS_DISLIKED); } if (config.IncludePostDate) { keys.Add(POST_DATE); } if (config.IncludeBoardId) { keys.Add(BOARD_ID); } return(keys); }
public IEnumerable <string> ReadIncludedValues(CommentInclusionConfiguration config, GetCommentModel comment) { char delimiter = ','; var values = new List <string>(); if (config.IncludeId) { values.Add(comment.Id.ToString()); } ; if (config.IncludeUserId) { values.Add(comment.UserId.ToString()); } if (config.IncludeText) { values.Add(comment.Text.Quote()); } if (config.IncludeUrl) { values.Add(comment.Url.Quote()); } if (config.IncludeKarma) { values.Add(comment.Karma.ToString()); } if (config.IncludeCommentIds) { values.Add(comment.CommentIds.ToDelimitedList(delimiter).Quote()); } if (config.IncludeParentCommentId) { values.Add(comment.ParentCommentId.ToString()); } if (config.IncludeParentArticleId) { values.Add(comment.ParentArticleId.ToString()); } if (config.IncludeDeleted) { values.Add(comment.Deleted.ToString()); } if (config.IncludeUsersLiked) { values.Add(comment.UsersLiked.ToDelimitedList(delimiter).Quote()); } if (config.IncludeUsersDisliked) { values.Add(comment.UsersDisliked.ToDelimitedList(delimiter).Quote()); } if (config.IncludePostDate) { values.Add(comment.PostDate.ToString().Quote()); } if (config.IncludeBoardId) { values.Add(comment.BoardId.ToString()); } return(values); }