예제 #1
0
        public async Task <IActionResult> Topic(int id, int?page)
        {
            // Pagination

            int pageSize = 20;

            TopicViewModel vm = new TopicViewModel()
            {
                Topic = await _topicRepository.GetById(id),
                Posts = await _topicRepository.GetByIdWithPosts(id, page ?? 1, pageSize)
            };

            // Manually set breadcrumb nodes
            var childNode1 = new MvcBreadcrumbNode("Forum", "Home", vm.Topic.Forum.Title)
            {
                RouteValues = new { id = vm.Topic.Forum.Id }
            };
            var childNode2 = new MvcBreadcrumbNode("Topic", "Home", "ViewData.Title")
            {
                OverwriteTitleOnExactMatch = true,
                Parent = childNode1
            };

            ViewData["BreadcrumbNode"] = childNode2;

            return(View(vm));
        }