Beispiel #1
0
        public ActionResult TagsByCategory(string categoryName,
                                           bool isMultiSelection = false,
                                           string selectedValue  = null,
                                           string uniqueId       = null,
                                           bool onlyHot          = true,
                                           bool includeAll       = true,
                                           bool includeOther     = true)
        {
            if (!onlyHot)
            {
                includeOther = false;
            }
            if (isMultiSelection)
            {
                includeAll = false;
            }

            var tagList = _tagDriver.GetTagsByCategory(categoryName, onlyHot, includeAll, includeOther);

            tagList.MultiSelect   = isMultiSelection;
            tagList.Group         = categoryName;
            tagList.SelectedValue = selectedValue;
            tagList.UniqueId      = uniqueId;
            return(PartialView(tagList));
        }
        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));
        }