示例#1
0
        public PostStatistics GetStatistics()
        {
            PostStatistics res     = new PostStatistics();
            var            builder = Builders <Post> .Filter;

            res.TotalPublicPosts = _posts.CountDocuments(f => f.status == "2");
            res.TotalUsers       = _posts.AsQueryable().Select(e => e.author).Distinct().Count();

            return(res);
        }
        public ActionResult Get()
        {
            PostStatistics res = postService.GetStatistics();

            return(Ok(res));
        }