Exemplo n.º 1
0
        public virtual EntryItem[] GetEntries(Item blogItem, int maxCount)
        {
            IList <ItemUri> uris = new List <ItemUri>();

            switch (Algorithm)
            {
            case InterestingEntriesAlgorithm.Custom:
            case InterestingEntriesAlgorithm.Comments:
                uris = EntryManagerInstance.GetPopularEntriesByComment(blogItem, maxCount);
                break;

            case InterestingEntriesAlgorithm.PageViews:
                uris = EntryManagerInstance.GetPopularEntriesByView(blogItem, maxCount);
                break;
            }

            var entryItems = new List <EntryItem>();

            foreach (var uri in uris)
            {
                var item = Database.GetItem(uri);
                if (item != null)
                {
                    entryItems.Add(new EntryItem(item));
                }
            }

            return(entryItems.ToArray());
        }
Exemplo n.º 2
0
        public virtual EntryItem[] GetEntries(Item blogItem, int maxCount)
        {
            switch (Algorithm)
            {
            case InterestingEntriesAlgorithm.Custom:
            case InterestingEntriesAlgorithm.Comments:
                return(EntryManagerInstance.GetPopularEntriesByComment(blogItem, maxCount));

            case InterestingEntriesAlgorithm.PageViews:
                return(EntryManagerInstance.GetPopularEntriesByView(blogItem, maxCount));
            }
            return(new EntryItem[0]);
        }