public IActionResult Index() { var latestPosts = _postService.GetLatestPosts(5); var latestForums = _forumService.GetLatestForums(5); var latestForumsMapped = latestForums.Select(f => new ForumViewModel { Id = f.Id, Description = f.Description, ImageUrl = f.ImageUrl, Name = f.Title, UserId = f.User.Id, UserName = f.User.UserName, UserRating = f.User.Rating, Created = f.Created, PostsCount = f.Posts.Count() }); var latestPostsMaped = latestPosts.Select(p => new PostViewModel { Id = p.Id, Title = p.Title, AuthorId = p.User.Id, AuthorName = p.User.UserName, AuthorRating = p.User.Rating, DatePosted = p.Created.ToString(), RepliesCount = p.Replies.Count(), Forum = new ForumViewModel { Id = p.Forum.Id, Name = p.Forum.Title, ImageUrl = p.Forum.ImageUrl } }); var model = new ForumIndexModel() { LatestPosts = latestPostsMaped, ForumViewModels = latestForumsMapped }; return(View(model)); }