当前位置: 首页>>代码示例>>C#>>正文


C# Content.GetNextNews方法代码示例

本文整理汇总了C#中Content.GetNextNews方法的典型用法代码示例。如果您正苦于以下问题:C# Content.GetNextNews方法的具体用法?C# Content.GetNextNews怎么用?C# Content.GetNextNews使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Content的用法示例。


在下文中一共展示了Content.GetNextNews方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Detail

        public ActionResult Detail(string key)
        {
            key = key.ToLower();

            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 190 : 400;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 285 : 600;

            var modelOut = new ContentModel();
            string cacheKey = string.Concat(Lib.BOL.UserContent.Content.Key, key, Utilities.GetCurrentLanguageCode());

            if (HttpRuntime.Cache[cacheKey] == null)
            {
                var model = new Content(key);

                modelOut.ThumbIcon = Utilities.S3ContentPath(model.ContentPhotoThumbURL);

                var otherNews = new Content();

                otherNews.GetPreviousNews(model.ReleaseDate);
                if (otherNews.ContentID > 0)
                {
                    modelOut.PreviousNews = otherNews.ToUnorderdListItem;
                }

                otherNews = new Content();
                otherNews.GetNextNews(model.ReleaseDate);

                if (otherNews.ContentID > 0)
                {
                    modelOut.NextNews = otherNews.ToUnorderdListItem;
                }

                if (!string.IsNullOrWhiteSpace(model.ContentVideoURL2) &&
                    string.IsNullOrWhiteSpace(model.ContentVideoURL))
                {
                    // TODO: parse just the key, it's currently requiring the embed
                    model.ContentVideoURL2 = string.Concat(model.ContentVideoURL2, "?rel=0");
                    modelOut.VideoWidth = "100%";
                }

                modelOut.ContentID = model.ContentID;
                modelOut.ContentKey = model.ContentKey;
                modelOut.ContentPhotoThumbURL = model.ContentPhotoThumbURL;
                modelOut.ContentPhotoURL = model.ContentPhotoURL;
                modelOut.ContentTypeID = model.ContentTypeID;
                modelOut.ContentVideoURL = model.ContentVideoURL;
                modelOut.ContentVideoURL2 = model.ContentVideoURL2;
                modelOut.CurrentStatus = model.CurrentStatus;
                modelOut.Detail = model.Detail;
                modelOut.IsEnabled = model.IsEnabled;
                modelOut.Language = model.Language;
                modelOut.MetaDescription = model.MetaDescription;
                modelOut.MetaKeywords = model.MetaKeywords;
                modelOut.OutboundURL = model.OutboundURL;
                modelOut.ReleaseDate = model.ReleaseDate;
                modelOut.SiteDomainID = model.SiteDomainID;
                modelOut.Title = model.Title;
                modelOut.UrlTo = model.UrlTo;
                modelOut.CreateDate = model.CreateDate;
                modelOut.CreatedByUserID = model.CreatedByUserID;
                modelOut.UpdateDate = model.UpdateDate;
                modelOut.UpdatedByUserID = model.UpdatedByUserID;

                HttpRuntime.Cache.AddObjToCache(modelOut, cacheKey);
            }
            else
            {
                modelOut = (ContentModel) HttpRuntime.Cache[cacheKey];
            }

            return View(modelOut);
        }
开发者ID:dasklub,项目名称:kommunity,代码行数:72,代码来源:NewsController.cs


注:本文中的Content.GetNextNews方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。