public ActionResult Tag(string key, int? p, int? commend, string order) { var iscommend = commend ?? 0; var pager = new Pager {PageNo = p ?? 1, PageSize = Configinfo.CatePagerCount}; pager = MyService.GetTagArticlePaging(pager, 1, key.Replace("@", "."), iscommend, order); var archivesViewModel = new ArchivesViewModel { WebPath = "[" + res.Tag + "] " + key.Replace("@", "."), ArticlePagerInfo = pager }; var articleListParasInfo = new AjaxArticleListParamsModel { ArticleListType = "tag", Tag = key, Commend = iscommend, Order = order }; ViewBag.ArticleListParasInfo = articleListParasInfo; return View("Archives", archivesViewModel); }
public ActionResult Index(int? p, int? commend,string order) { ViewData["Test"] = "只要设置了ViewDataViewBag中就有数据"; var iscommend = commend ?? 0; var lst = MyService.GetIndexCategoryList(); foreach (var category in lst) { switch (category.Type) { case 1: ViewData["Articles_" + category.HomePageKey] = MyService.GetVArticles(0, category.CateId, category.ListNum == 0 ? 10 : category.ListNum); break; case 2: ViewData["SinglePage_" + category.HomePageKey] = MyService.GetVArticles(0, category.CateId, category.ListNum == 0 ? 10 : category.ListNum); break; case 4: ViewData["Albums_" + category.HomePageKey] = MyService.GetAlbums(category.CateId, category.ListNum == 0 ? 10 : category.ListNum); break; case 6: ViewData["Notes_" + category.HomePageKey] = MyService.GetVArticles(0, category.CateId, category.ListNum == 0 ? 10 : category.ListNum); break; case 7: { var re = MyService.GetVArticles(7, 0, 0); if (re != null && re.Any()) { foreach (var varticle in re) { ViewData["Home_" + varticle.title] = varticle.content; } } } break; } } var pager = new Pager { PageNo = p ?? 1, PageSize = Configinfo.IndexPagerCount }; pager = MyService.GetArticlePaging(pager, 1, 0, iscommend, order: order); var indexViewModel = new IndexViewModel { WebTitle = Configinfo.Webtitle, ArticleDates = MyService.GetArticleDates(), ArticleArchivesInfo = MyService.GetArticleArchives(), NewBbsTopics = MyService.GetVArticles(5, 0, 10), MostViewArticles = MyService.GetVArticles(1, 0, 10, field: "viewcount"), MostCommendArticles = MyService.GetVArticles(1, 0, 10, field: "favor"), MostReplyArticles = MyService.GetVArticles(1, 0, 10, field: "subcount"), NewReplyArticles = MyService.GetVArticles(1, 0, 10, field: "lastpost"), NewArticleReplies = MyService.GetReplyArticles(1, 0, 10), Tags = MyService.GetTagList(1, 0), ArticleCount = MyService.GetArticleCountByType(1), AlbumCount = MyService.GetArticleCountByType(4), NoteCount = MyService.GetArticleCountByType(6), ArticleReplyCount = MyService.GetArticleCountByType(1, 1), AlbumReplyCount = MyService.GetArticleCountByType(4, 1), ArticlePagerInfo = pager }; var articleListParasInfo = new AjaxArticleListParamsModel { ArticleListType = "index", Commend = iscommend, Order = order }; ViewBag.ArticleListParasInfo = articleListParasInfo; return View(indexViewModel); }
public ActionResult Author(string user, int? p, int? commend, string order) { var iscommend = commend ?? 0; var pager = new Pager { PageNo = p ?? 1, PageSize = Configinfo.CatePagerCount }; pager = MyService.GetAuthorArticlePaging(pager, 1, user, iscommend, order); var archivesViewModel = new ArchivesViewModel { WebPath = "[Author] " + user, ArticlePagerInfo = pager }; var articleListParasInfo = new AjaxArticleListParamsModel { ArticleListType = "author", AuthorName = user, Commend = iscommend, Order = order }; ViewBag.ArticleListParasInfo = articleListParasInfo; return View("Archives", archivesViewModel); }
public ActionResult Category(int id, int? p, int? commend, int? f, string order) { var category = MyService.GetCategoryById(id); var currenturl = WebUtils.GetCateUrl(category); var webPath = MyService.GetCategoryPathUrl(category.Path); var pager = new Pager { PageNo = p ?? 1 }; switch (category.Type) { case 2: var re = MyService.GetVArticles(0, id, 0); if (re.Any()) { var varticle = re.ToList()[0]; var singleViewModel = new SingleViewModel { WebTitle = category.CateName, WebPath = webPath, CurrentUrl = currenturl, ArticleInfo = varticle, Category = category }; return View(WebUtils.GetViewName(category.CustomView, "Single"), singleViewModel); } return View("Error"); case 4: var albumsViewModel = new AlbumsViewModel { WebTitle = category.CateName, WebPath = webPath, CurrentUrl = currenturl, Category = category, Albums = MyService.GetAlbums(id), }; return View(WebUtils.GetViewName(category.CustomView, "Albums"), albumsViewModel); case 6: var note = new NoteModel { CategoryId = id, NoteId = 0, DataType = 1, UserId = UserInfo == null ? 0 : UserInfo.userid, UserName = UserInfo == null ? string.Empty : UserInfo.username }; pager.PageSize = Configinfo.NotePagerCount; var orderType = string.IsNullOrEmpty(order) ? "desc" : order; if (f != null && f > 0) { pager = MyService.GetFloorNoteByOrderId(pager, id, (long)f, orderType); } else { pager = MyService.GetFloorNotePaging(pager, id, orderType); } var noteViewModel = new NoteViewModel { WebTitle = category.CateName, WebPath = webPath, CurrentUrl = currenturl, Note = note, NoteList = new NoteListViewModel { NotePagerInfo = pager }, NoteOrderType = orderType, Category = category }; return View(WebUtils.GetViewName(category.CustomView, "Note"), noteViewModel); default: var iscommend = commend ?? 0; pager.PageSize = Configinfo.CatePagerCount; pager = category.SubCount > 0 ? MyService.GetArticlePaging(pager, 0, id, MyService.GetCategoryIds(id), iscommend, order) : MyService.GetArticlePaging(pager, 0, id, iscommend, order: order, articleListType: "category"); var categoryViewModel = new CategoryViewModel { WebTitle = category.CateName, WebPath = webPath, CurrentUrl = currenturl, IsCommend = iscommend, CateId = id, ArticlePagerInfo = pager, Category = category }; var articleListParasInfo = new AjaxArticleListParamsModel { ArticleListType = "category", CategoryId = id, Commend = iscommend, Order = order }; ViewBag.ArticleListParasInfo = articleListParasInfo; return View(WebUtils.GetViewName(category.CustomView, "Category"), categoryViewModel); } }
public ActionResult Archives(int year, int? month, int? day, int? p, int? commend, string order) { var iscommend = commend ?? 0; var pager = new Pager {PageNo = p ?? 1, PageSize = Configinfo.CatePagerCount}; pager = MyService.GetArchivesArticlePaging(pager, 1, year, month ?? 0, day ?? 0, iscommend, order); var archivesViewModel = new ArchivesViewModel { WebPath = "[" + res.Archive + "] " + year + (month != null ? "/" + month : string.Empty) + (day != null ? "/" + day : string.Empty), ArticlePagerInfo = pager }; var articleListParasInfo = new AjaxArticleListParamsModel { ArticleListType = "archives", Year = year, Month = month ?? 0, Day = day ?? 0, Commend = iscommend, Order = order }; ViewBag.ArticleListParasInfo = articleListParasInfo; return View(archivesViewModel); }