public static YoutubeCommentThreads OrderBy(this YoutubeCommentThreads commentThreads, CommentOrder order) { var settings = commentThreads.Settings.Clone(); settings.Order = order; return(CommentThreads(settings, commentThreads.PartTypes.ToArray())); }
public static TCommentDiscussion Create <TCommentDiscussion>(string businessKey, bool isEncrypted = false, CommentOrder commentOrder = BusinessEntities.CommentOrder.RecentFirst, int?maxComments = null, bool isReadOnly = false) where TCommentDiscussion : CommentDiscussion, new() { var newDiscussion = new TCommentDiscussion { BusinessKey = businessKey, CommentOrder = (int)commentOrder, IsEncrypted = isEncrypted, IsReadOnly = isReadOnly, MaxComments = maxComments }; BaseUserContext.Instance.Repository.Add <Entities.Discussion, TCommentDiscussion>(newDiscussion); return(newDiscussion); }
public static TDiscussion Create <TDiscussion>(string businessKey, string title = null, string body = null, string creator = null, bool isEncrypted = false, CommentOrder commentOrder = CommentOrder.RecentFirst, int?maxComments = null, bool isReadOnly = false) where TDiscussion : class, IDiscussion, IDocument, new() { var newDiscussion = new TDiscussion { BusinessKey = businessKey, Key = CalculateKey(businessKey), CommentOrder = commentOrder, IsEncrypted = isEncrypted, Title = title, Body = body, Creator = creator, Notifiers = new HashSet <string>() }; newDiscussion.Notifiers.Add(creator); newDiscussion.Save(); return(newDiscussion); }
public static TCommentDiscussion GetOrCreate <TCommentDiscussion>(string businessKey, bool isEncrypted = false, CommentOrder commentOrder = BusinessEntities.CommentOrder.RecentFirst, int?maxComments = null, bool isReadOnly = false) where TCommentDiscussion : CommentDiscussion, new() { var discussion = BaseUserContext.Instance.Repository.Find <Entities.Discussion, TCommentDiscussion>(el => el.BusinessKey == businessKey); if (discussion != null) { return(discussion); } return(Create <TCommentDiscussion>(businessKey, isEncrypted, commentOrder, maxComments, isReadOnly)); }
public static TDiscussion GetOrCreate <TDiscussion>(string businessKey, string title = null, string body = null, string creator = null, bool isEncrypted = false, CommentOrder commentOrder = CommentOrder.RecentFirst, int?maxComments = null, bool isReadOnly = false) where TDiscussion : class, IDiscussion, IDocument, new() { var discussion = Get <TDiscussion>(businessKey); return(discussion ?? Create <TDiscussion>(businessKey, title, body, creator, isEncrypted, commentOrder, maxComments, isReadOnly)); }