public bool AddArticle(ArticleInformation aInfo) { ScoopArticle newArticle = new ScoopArticle(); newArticle.BigHeadline = aInfo.BigHeadline; newArticle.BigText = aInfo.BigText; newArticle.BigImageURL = aInfo.BigImageURL; newArticle.SmallHeadline = aInfo.SmallHeadline; newArticle.SmallText = aInfo.SmallText; newArticle.SmallImageURL = aInfo.SmallImageURL; newArticle.ContentBlock = aInfo.ContentBlock; newArticle.Title = aInfo.Title; newArticle.PubDate = aInfo.PubDate; newArticle.AuthorID = aInfo.AuthorID; newArticle.Rank = aInfo.Rank; newArticle.ShowBigImage = aInfo.ShowBigImage; newArticle.ArticleType = aInfo.ArticleType; newArticle.Keywords = aInfo.Keywords; newArticle.DBKeywords = SearchText.GetKeywordList(new List <string>() { aInfo.Keywords }); database.ScoopArticles.Add(newArticle); return(database.SaveChanges() > 0); }
private ArticleDisplayInfo ToArticleDisplayInfo(ScoopArticle article, int index) { return(new ArticleDisplayInfo() { ArticleID = article.ArticleID, Headline = index == 0 ? article.BigHeadline : article.SmallHeadline, Subheadline = index == 0 ? article.BigText : article.SmallText, ImageURL = index == 0 ? article.BigImageURL : article.SmallImageURL }); }
private ArticleSummary ToArticleSummary(ScoopArticle article, bool bWantHeadline = false) { return(new ArticleSummary() { ArticleID = article.ArticleID, Title = bWantHeadline ? article.BigHeadline : article.Title, PublishDate = article.PubDate.HasValue ? article.PubDate.Value.ToString("MMMM dd, yyyy") : "", Rank = ArticleInformation.ArticleRanks.ArticleRankList[article.Rank], Author = article.User.FullName, ImgURL = article.BigImageURL, Description = article.BigText, ArticleType = ArticleInformation.ArticleTypes.ArticleTypeList[article.ArticleType] }); }
private ArticleInformation ToArticleInformation(ScoopArticle article) { return(new ArticleInformation() { ArticleID = article.ArticleID, BigHeadline = article.BigHeadline, BigText = article.BigText, BigImageURL = article.BigImageURL, SmallHeadline = article.SmallHeadline, SmallText = article.SmallText, SmallImageURL = article.SmallImageURL, ContentBlock = HttpUtility.HtmlDecode(article.ContentBlock), Title = article.Title, PubDate = article.PubDate, AuthorID = article.AuthorID, ShowBigImage = article.ShowBigImage, Rank = article.Rank, ArticleType = article.ArticleType, Keywords = article.Keywords }); }