/// <summary>
        /// 获取推送文章列表
        /// </summary>
        /// <param name="eventkey">点击事件 Key</param>
        /// <param name="takeCount">推送文章数量</param>
        /// <returns></returns>
        private List <ArticleInfoView> GetPushArticles(string eventkey, int takeCount = 6)
        {
            var articles = _articleInfoService.GetList <ArticleInfoView>(t => t.ArticleStatus == "Published" && t.ArticleCateSub == eventkey)
                           .OrderBy("PublishDate", System.ComponentModel.ListSortDirection.Descending)
                           .Take(takeCount).ToList();

            return(articles);
        }
Ejemplo n.º 2
0
        public void DB()
        {
            var articleInfoService = new ArticleInfoService();

            //添加测试数据
            articleInfoService.Repository.Insert(new ArticleInfo
            {
                Id             = 1,
                ArticleTitle   = "test",
                ArticleContent = "content",
                ArticleCateSub = "1",
                //ArticleCate = 1,
                ArticleCode    = Guid.NewGuid(),
                ArticleComment = "comment",
                //ArticleContentEdit = "edit",
                ArticleStatus = "new",
                ArticleURL    = "abc/123.html",
                CreatedDate   = DateTime.Now,
                CreatedUserID = "me",
                IsDeleted     = false,
                LanguageCode  = "zh",
                ReadCount     = 0,
                UpdatedDate   = DateTime.Now
            });

            var article = articleInfoService.GetList <ArticleInfoView>(x => x.Id > 0);

            Assert.IsTrue(article.Count == 1);
        }
Ejemplo n.º 3
0
        public void GetArticleThumbup()
        {
            var service = new ArticleInfoService();

            var list = service.GetList <ArticleInfoView>(x => x.Id == 68, new PageCondition());

            Assert.IsTrue(list.Count == 1);
        }