Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var forumsOld = _forumService.GetAllOldTestament().Select(forum => new ForumListingModel {
                Id            = forum.Id,
                Title         = forum.Title,
                Description   = forum.Description,
                NumberOfPosts = forum.Posts?.Count() ?? 0, //check to see if its null < ? >
                NumberOfUsers = _forumService.GetActiveUsers(forum.Id).Count(),
                ImageUrl      = forum.ImageUrl,
                HasRecentPost = _forumService.HasRecentPost(forum.Id),
                BookOrder     = forum.BookOrder,
                OldOrNew      = forum.OldOrNew
            });

            var forumsNew = _forumService.GetAllNewTestament().Select(forum => new ForumListingModel
            {
                Id            = forum.Id,
                Title         = forum.Title,
                Description   = forum.Description,
                NumberOfPosts = forum.Posts?.Count() ?? 0, //check to see if its null < ? >
                NumberOfUsers = _forumService.GetActiveUsers(forum.Id).Count(),
                ImageUrl      = forum.ImageUrl,
                HasRecentPost = _forumService.HasRecentPost(forum.Id),
                BookOrder     = forum.BookOrder,
                OldOrNew      = forum.OldOrNew
            });

            var model = new ForumIndexModel {
                ForumListingOld = forumsOld,
                ForumListingNew = forumsNew
            };

            return(View(model));
        }