Beispiel #1
0
        public async Task <IActionResult> Index()
        {
            var currentUser = await _userManager.GetUserAsync(User);

            //if (currentUser == null) return Challenge();

            //this was var items = await _BlogService.GetBlogPostAsync(currentUser);
            var items = await _BlogService.GetBlogPostAsync();

            return(View(items));

            //var currentUser = await _userManger.GetUserAsync(User);
        }
Beispiel #2
0
        public async Task <IActionResult> Index()
        {
            StatsViewModel statsView = new StatsViewModel();
            //statsView.blogPosts

            var blogs = await _blogItemService.GetBlogPostAsync();

            var channels = await _channelService.GetChannelsAsync();

            var comments = await _blogItemService.GetCommentsAsync();

            statsView.blogPostslSize = blogs.Length;
            statsView.channelsSize   = channels.Length;
            statsView.commentsSize   = comments.Length;
            statsView.indvComments   = await _blogItemService.GetCommentCountByUserAsync();

            statsView.indvPosts = await _blogItemService.GetPostCountByUserAsync();

            statsView.mostRecentComment = await _context.comments.OrderByDescending(c => c.Posted).Take(1).ToArrayAsync();

            return(View(statsView));
        }