示例#1
0
 public IEnumerable <ChartData> GetBlogPostPublishStatisticByDate()
 {
     return(ArticleBiz.Read(c => c.State == ContentState.Published && c.Type == ContentType.BlogPost, true).GroupBy(c => DbFunctions.TruncateTime(c.CreateDate))
            .Select(group => new ChartData {
         Date = group.Key.Value, Value = group.Count()
     })
            .OrderBy(p => p.Date));
 }
示例#2
0
        public void ReadArticleForEdit(UserIdentity userIdentity, int contentId, out ContentRegistrationPM contentPresentationModel, out List <string> tags)
        {
            var content = ArticleBiz.Read(c =>
                                          c.AuthorId == userIdentity.UserId &&
                                          c.Type == ContentType.Article &&
                                          c.State != ContentState.Blocked &&
                                          c.Id == contentId)
                          .Include(c => c.Tags)
                          .Single();

            contentPresentationModel = content.GetContentRegistrationPM();
            tags = new List <string>(content.Tags.Select(tag => tag.Text));
        }
示例#3
0
        public AdminDashboardModelContainer GetAdminDashboardStatistics()
        {
            var today = DateTime.Now.Date;

            return(new AdminDashboardModelContainer()
            {
                TodayVisitsCount =
                    VisitBiz.GetTodaySiteTotalVisitsCount(),
                TotalArticlesCount =
                    ArticleBiz.Read(c => c.State == ContentState.Published && c.Type == ContentType.Article).Count(),
                TotalBlogPostCount =
                    ArticleBiz.Read(c => c.State == ContentState.Published && c.Type == ContentType.BlogPost).Count(),
                TotalUsersCount = UserBiz.Read().Count(),
                NewUsers = UserBiz.GetNewUsers(top: 3).MapTo <AdminDashboardNewUserPm>().ToList(),
                NewArticles = ArticleBiz.ReadLatestArticles(3).MapTo <AdminDashboardNewArticlePm>().ToList()
            });
        }