public ActionResult SectionDetail(int sectId, int p = 1) { SubSection subSection = _bbsService.GetSubSection(sectId); ViewBag.subsection = subSection; int total; var topics = _bbsService.GetTopics(out total, sectId, p, 10, "", "CreateTime DESC"); var pageList = new MvcPager.PagedList <Topic>(topics, p, 10, total); return(View(pageList)); }
public ActionResult ResourceList(int sortId = 0, string orderF = "AuditTime", int dir = 0, int pageIndex = 1, int pageSize = 20) { int total; var list = _resourceManager.GetResourceList(out total, CurrentTenant.TenantId, sortId, "", "", 99, "", null, null, pageIndex, pageSize, string.IsNullOrEmpty(orderF) ? "AuditTime DESC" : (orderF + " " + (dir == 0 ? "ASC" : "DESC"))); var pagedlist = new MvcPager.PagedList <KL_Resource>(list, pageIndex, pageSize, total); var allsorts = _sortManager.GetAllSortList(CurrentTenant.TenantId); var sorttree = new List <KL_KnowledgeSort>(); var leaf = allsorts.Find(s => s.SortId == sortId); while (leaf != null) { sorttree.Add(leaf); leaf = allsorts.FirstOrDefault(s => s.SortId == leaf.ParentId); } ViewBag.allSorts = allsorts; ViewBag.sortTree = sorttree; return(View(pagedlist)); }
/// <summary> /// 加入的版块 /// </summary> /// <returns></returns> public ActionResult JoinSections(string kw = "", int info = 0, int p = 1) { ViewBag.info = info; switch (info) { case 0: //加入的版块 ViewBag.datalist = _bbsService.GetUserCollectSection(CurrentUser.UserId, kw); break; case 1: //创建的版块 { var subs = _bbsService.GetCreateSections(CurrentUser.UserId, kw, false); var mIds = subs.Select(s => s.Sectionid).Distinct(); var ms = _bbsService.GetSectionByIds(mIds); foreach (var section in ms) { section.SubSections.AddRange(subs.Where(s => s.Sectionid == section.SectionId)); } ViewBag.datalist = ms; } break; case 2: //发起的主题 { int total; var topics = _bbsService.GetCreateTopic(out total, CurrentUser.UserId, kw, p, 10); var pagelist = new MvcPager.PagedList <Topic>(topics, p, 10, total); ViewBag.datalist = pagelist; } break; case 3: //回复的主题 { int total; var topics = _bbsService.GetReplyTopic(out total, CurrentUser.UserId, kw, p, 20); var pagelist = new MvcPager.PagedList <Topic>(topics, p, 20, total); ViewBag.datalist = pagelist; } break; } return(View()); }
public ActionResult SearchTopic(int p = 1, string kw = "", string orderF = "createTime", int dir = 0) { //初始化数据 //int total1; //var topics = _bbsService.GetTopics(out total1, 0, 0, 1, 20000, "", "", null, null); //foreach (var topic in topics) //{ // FullTextSearchProvider.Index(topic, "bbstopic", topic.TopicId); //} long total; var must = new Dictionary <string, object>(); //must.Add("isThematic", 0); must.Add("isHide", 0); must.Add("isDelete", 0); var list = FullSearchService.FullTextSearchProvider.Search <Topic>(out total, "bbstopic", new[] { "title", "topicContent", "tags" }, kw, (p - 1) * 20, 20, "<em>", "</em>", must, dir, orderF); var pagedList = new MvcPager.PagedList <SearchResult <Topic> >(list, p, 20, (int)total); return(View(pagedList)); }