private void ProcessTagOption(TopicClient topic) { if (topic == null) { return; } var tagCategoryMaps = _threadDriver.GetTagCategories(topic.ThreadId); List <TagListClient> tagLists = new List <TagListClient>(); foreach (var map in tagCategoryMaps) { var tagList = _tagDriver.GetTagsByCategory(map.TagCategory.Name, map.OnlyShowHotTag, false, map.IncludeOther); if (topic.IsNew() && tagList.Count > 0) { topic.TagOptions.Add(new TagOptionClient() { CategoryName = map.TagCategory.Name, IdStrs = tagList[0].Id.ToString() }); } TagOptionClient tagOption = topic.TagOptions.SingleOrDefault(x => x.CategoryName == map.TagCategory.Name); if (tagOption != null) { tagList.SelectedValue = tagOption.IdStrs; } tagLists.Add(tagList); } ViewBag.TagLists = tagLists; }
private void ProcessTagOption(TopicClient topic) { if (topic == null) return; var tagCategoryMaps = _threadDriver.GetTagCategories(topic.ThreadId); List<TagListClient> tagLists = new List<TagListClient>(); foreach (var map in tagCategoryMaps) { var tagList = _tagDriver.GetTagsByCategory(map.TagCategory.Name, map.OnlyShowHotTag, false, map.IncludeOther); if (topic.IsNew() && tagList.Count > 0) { topic.TagOptions.Add(new TagOptionClient() { CategoryName = map.TagCategory.Name, IdStrs = tagList[0].Id.ToString()}); } TagOptionClient tagOption = topic.TagOptions.SingleOrDefault(x => x.CategoryName == map.TagCategory.Name); if (tagOption != null) { tagList.SelectedValue = tagOption.IdStrs; } tagLists.Add(tagList); } ViewBag.TagLists = tagLists; }