コード例 #1
0
 private static IQueryable <BlogQueryEntity> prepareQuery(ApplicationDbContext context, BlogEntity entity)
 {
     return(context.JGN_Blogs
            .Join(context.AspNetusers,
                  blogs => blogs.userid,
                  user => user.Id, (blogs, user) => new { blogs, user })
            .Join(context.JGN_AbuseReports,
                  blogs => blogs.blogs.id,
                  abusereports => abusereports.contentid, (blogs, abusereports) => new BlogQueryEntity {
         blog = blogs.blogs, user = blogs.user, abusereports = abusereports
     })
            .Where(BlogsBLL.returnWhereClause(entity)));
 }
コード例 #2
0
        public static async Task <GoogleChartEntity> GroupByMonth(ApplicationDbContext context, BlogEntity entity)
        {
            var reportData = await context.JGN_Blogs
                             .Join(context.AspNetusers,
                                   blog => blog.userid,
                                   user => user.Id,
                                   (blog, user) => new BlogQueryEntity
            {
                blog = blog,
                user = user
            })
                             .Where(BlogsBLL.returnWhereClause(entity))
                             .GroupBy(o => new
            {
                month = o.blog.created_at.Month
            })
                             .Select(g => new ReportEntity
            {
                Month = g.Key.month,
                Total = g.Count()
            })
                             .OrderBy(a => a.Month)
                             .ToListAsync();

            var newObject = new { role = "style" };
            var data      = new GoogleChartEntity()
            {
                chartType = entity.chartType,
                dataTable = new List <dynamic[]>
                {
                    new dynamic[] { "Month", "Posted Blogs", newObject },
                    new dynamic[] { "Copper", 8.94, "#b87333" },
                    new dynamic[] { "Silver", 10.49, "silver" },
                    new dynamic[] { "Gold", 19.30, "gold" },
                }
            };

            data.report = reportData;
            foreach (var item in reportData)
            {
                // data.dataTable.Add(new dynamic[] { item.Year.ToString(), item.Total, "color: #76A7FA" });
            }

            return(data);
        }
コード例 #3
0
        public static async Task <GoogleChartEntity> GroupByDay(ApplicationDbContext context, BlogEntity entity)
        {
            var reportData = await context.JGN_Blogs
                             .Join(context.AspNetusers,
                                   blog => blog.userid,
                                   user => user.Id,
                                   (blog, user) => new BlogQueryEntity
            {
                blog = blog,
                user = user
            })
                             .Where(BlogsBLL.returnWhereClause(entity))
                             .GroupBy(o => new
            {
                day = o.blog.created_at.Day
            })
                             .Select(g => new ReportEntity
            {
                Day   = g.Key.day,
                Total = g.Count()
            })
                             .OrderBy(a => a.Day)
                             .ToListAsync();

            var newObject = new { role = "style" };
            var data      = new GoogleChartEntity()
            {
                chartType = entity.chartType,
                dataTable = new List <dynamic[]>
                {
                    new dynamic[] { "Day", "Posted Blogs", newObject },
                }
            };

            data.report = reportData;
            foreach (var item in reportData)
            {
                data.dataTable.Add(new dynamic[] { item.Year.ToString(), item.Total, "color: #76A7FA" });
            }

            return(data);
        }
コード例 #4
0
 private static IQueryable <BlogQueryEntity> prepareQuery(ApplicationDbContext context, BlogEntity entity)
 {
     return(context.JGN_Blogs
            .Join(context.AspNetusers,
                  blog => blog.userid,
                  user => user.Id, (blog, user) => new { blog, user })
            .Join(context.JGN_CategoryContents,
                  blog => blog.blog.id,
                  blog_category => blog_category.contentid, (blog, blog_category) => new { blog, blog_category })
            .Join(context.JGN_Categories,
                  blog_category => blog_category.blog_category.categoryid,
                  category => category.id, (blog_category, category) =>
                  new BlogQueryEntity
     {
         blog = blog_category.blog.blog,
         blog_category = blog_category.blog_category,
         category = category,
         user = blog_category.blog.user
     })
            .Where(BlogsBLL.returnWhereClause(entity)));
 }