public static GgcmsArticles Clone(dynamic dinfo) { var info = new GgcmsArticles { Author = dinfo.Author, Category_Id = dinfo.Category_Id, CreateTime = dinfo.CreateTime, Description = dinfo.Description, ExtModelId = dinfo.ExtModelId, Hits = dinfo.Hits, Id = dinfo.Id, Keywords = dinfo.Keywords, MobileTmplName = dinfo.MobileTmplName, PageTitle = dinfo.PageTitle, RedirectUrl = dinfo.RedirectUrl, Source = dinfo.Source, SourceUrl = dinfo.SourceUrl, StyleName = dinfo.StyleName, Title = dinfo.Title, TitleImg = dinfo.TitleImg, TitleThumbnail = dinfo.TitleThumbnail, TmplName = dinfo.TmplName, ShowLevel = dinfo.ShowLevel, ShowType = dinfo.ShowType, }; return(info); }
//获取文章列表 public GgcmsArticles Article(int id, int page = 1) { GgcmsArticles article = db.GgcmsArticles.Find(id); if (page > 1) { GgcmsArticlePages art_page = db.GgcmsArticlePages.Where(x => x.Article_Id == id && x.OrderId == page).FirstOrDefault(); if (art_page != null) { article.Content = art_page.Content; article.PageTitle = art_page.Title; } } var list = from r in db.GgcmsAttachments where r.Articles_Id == article.Id select r; article.attachments = list.ToList(); article.RedirectUrl = string.IsNullOrEmpty(article.RedirectUrl.Trim()) ? Prefix + "/Article/" + article.Id.ToString() : article.RedirectUrl; if (article.ExtModelId > 0) { article.ModuleInfo = ExtendModule.GetGgcmsModule(article.ExtModelId); article.ModuleData = ExtendModule.GetModuleToDict(article.Id, article.ModuleInfo, false); } return(article); }
public GgcmsArticles Clone() { var info = new GgcmsArticles { Author = Author, Category_Id = Category_Id, CreateTime = CreateTime, Description = Description, ExtModelId = ExtModelId, Hits = Hits, Id = Id, Keywords = Keywords, MobileTmplName = MobileTmplName, PageTitle = PageTitle, RedirectUrl = RedirectUrl, Source = Source, SourceUrl = SourceUrl, StyleName = StyleName, Title = Title, TitleImg = TitleImg, TitleThumbnail = TitleThumbnail, TmplName = TmplName, ShowLevel = ShowLevel, ShowType = ShowType, Content = Content, MemberId = MemberId, }; return(info); }
public SearchResult <GgcmsArticles> Articles(SearchParams rparams) { if (string.IsNullOrWhiteSpace(rparams.Columns)) { rparams.Columns = "Author,Category_Id,CreateTime,Description,ExtModelId,Hits,Id,Keywords,MobileTmplName,PageTitle,RedirectUrl,Source,SourceUrl,StyleName,Title,TitleImg,TitleThumbnail,TmplName,ShowLevel,ShowType"; } var result = GetRecords <GgcmsArticles>(rparams); List <GgcmsArticles> list = result.GetList(); result.Records = new List <dynamic>(); foreach (var ainfo in list) { GgcmsArticles ninfo = GgcmsArticles.Clone(ainfo); ninfo.RedirectUrl = string.IsNullOrEmpty(ninfo.RedirectUrl.Trim()) ? Prefix + "/Article/" + ninfo.Id.ToString() : ninfo.RedirectUrl; result.Records.Add(ninfo); } return(result); }