Esempio n. 1
0
        public ActionResult Thread(string key, int? page)
        {
  
            var currentThread = string.IsNullOrEmpty(key) ? _threadDriver.RootThread : _threadDriver.GetThreadByKey(key);
            if (currentThread == null) { return HttpNotFound(); }

            var tagCategoryMaps = _threadDriver.GetTagCategories(currentThread.Id);
            List<TagListClient> tagLists = new List<TagListClient>();
            foreach (var map in tagCategoryMaps)
            {
                var tagList = _tagDriver.GetTagsByCategory(map.TagCategory.Name, map.OnlyShowHotTag, map.IncludeAll, map.IncludeOther);
                tagLists.Add(tagList);
            }
            ViewBag.TagLists = tagLists;


            PageTopicFilterClient topicFilter = new PageTopicFilterClient();
            topicFilter.PageNumber = GetPageNumber(page);;
            topicFilter.ThreadKey = currentThread.Key;
            topicFilter.Sort = " CreateTime DESC";
            PageListClient<TopicClient> pageList = _topicDriver.PagingClientTopics(DefaultSetting.TopicsPerPage, topicFilter);
            PageTopicClient pageTopic = new PageTopicClient() { Page = pageList, Filter = topicFilter };

            ViewBag.CurrentThread = currentThread;
         
            pageTopic.Page.GenerateUniqueId();
            return View("Thread", pageTopic);
        }
Esempio n. 2
0
        public ActionResult Thread(string key, int?page)
        {
            var currentThread = string.IsNullOrEmpty(key) ? _threadDriver.RootThread : _threadDriver.GetThreadByKey(key);

            if (currentThread == null)
            {
                return(HttpNotFound());
            }

            var tagCategoryMaps           = _threadDriver.GetTagCategories(currentThread.Id);
            List <TagListClient> tagLists = new List <TagListClient>();

            foreach (var map in tagCategoryMaps)
            {
                var tagList = _tagDriver.GetTagsByCategory(map.TagCategory.Name, map.OnlyShowHotTag, map.IncludeAll, map.IncludeOther);
                tagLists.Add(tagList);
            }
            ViewBag.TagLists = tagLists;


            PageTopicFilterClient topicFilter = new PageTopicFilterClient();

            topicFilter.PageNumber = GetPageNumber(page);;
            topicFilter.ThreadKey  = currentThread.Key;
            topicFilter.Sort       = " CreateTime DESC";
            PageListClient <TopicClient> pageList = _topicDriver.PagingClientTopics(DefaultSetting.TopicsPerPage, topicFilter);
            PageTopicClient pageTopic             = new PageTopicClient()
            {
                Page = pageList, Filter = topicFilter
            };

            ViewBag.CurrentThread = currentThread;

            pageTopic.Page.GenerateUniqueId();
            return(View("Thread", pageTopic));
        }