示例#1
0
        public static YoutubeCommentThreads OrderBy(this YoutubeCommentThreads commentThreads, CommentOrder order)
        {
            var settings = commentThreads.Settings.Clone();

            settings.Order = order;
            return(CommentThreads(settings, commentThreads.PartTypes.ToArray()));
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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));
        }
示例#5
0
        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));
        }