public ActionResult Content(CardsModels model) { long menuId = CardsDAO.GetMenuID(model.No); ArticleSettingModels setting = ArticleSettingDAO.GetItem(menuId); ViewBag.Setting = setting; ArticleModels item = ArticleDAO.GetItemByCard(model.No); item.ReplyCommentSetting = setting; IEnumerable <ArticleTypesModels> types = item.GetTypes(); ViewBag.Types = types; IEnumerable <ArticleSeriesModels> series = item.GetSeries(); ViewBag.Series = series; IEnumerable <ArticleCategoryModels> readModeCategories = item.GetCategories(IdentityType); ViewBag.ReadModeCategories = readModeCategories; string uploadUrl = UpdFileInfo.GetVPathByMenuID(model.SiteID, menuId).TrimEnd('/') + "/"; RecommendHandler(item.ID, setting, uploadUrl, types); RecommendHandler2(item.ID, setting, uploadUrl, types); //string key = "AllArticleID_" + menuId; //long[] allArticleIds = HttpRuntime.Cache[key] as long[]; //if(allArticleIds == null) { // allArticleIds = ArticleDAO.GetAllIDs(menuId).ToArray(); // HttpRuntime.Cache.Add(key, allArticleIds, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0), System.Web.Caching.CacheItemPriority.Normal, null); //} long[] allArticleIds = ArticleDAO.GetAllIDs(setting).ToArray(); int index = Array.IndexOf(allArticleIds, item.ID); ViewBag.ListSitePageIndex = (index / setting.PageSize) + 1; if (index <= 0) { ViewBag.Prev = null; } else { ArticleModels prev = ArticleDAO.GetItem(allArticleIds[index - 1]); ViewBag.Prev = prev; ViewBag.PrevSitePage = CardsDAO.GetPage(prev.CardNo); } ViewBag.ListSitePage = MenusDAO.GetListPage(menuId); if (index == allArticleIds.Length - 1) { ViewBag.Next = null; } else { ArticleModels next = ArticleDAO.GetItem(allArticleIds[index + 1]); ViewBag.Next = next; ViewBag.NextSitePage = CardsDAO.GetPage(next.CardNo); } SitePage page = CardsDAO.GetPage(model.No); long pageID = page.PageNo; ViewBag.UploadUrl = uploadUrl; ViewBag.SiteID = model.SiteID; ViewBag.SiteSN = page.SiteSN; ViewBag.MenuID = menuId; ViewBag.PageID = pageID; ViewBag.CollectionResult = MemberShipDAO.CheckMemberCollectionExist(pageID); ViewBag.CollectionCount = MemberShipDAO.GetPageCollectionCount(pageID); ViewBag.Style = model.StylesID == 0 ? 1 : model.StylesID; ArticleDAO.AddItemClicks(item.ID); int style = model.StylesID == 0 ? 1 : model.StylesID; string ViewFileName = string.Format("~/Views/Article/ContentStyle{0}.cshtml", style); if (!System.IO.File.Exists(Server.MapPath(ViewFileName))) { style = 1; } ViewFileName = string.Format("~/Views/Article/ContentStyle{0}.cshtml", style); return(View(ViewFileName, item)); }