public Item CreateNewsArticle(NewsArticle newsArticle) { var newItem = ParentItem.Add(newsArticle.Title, Template); _iFieldUpdater.AddFieldsToItem(newItem, newsArticle); return newItem; }
public void DeleteNewsArticle(NewsArticle newsArticle) { var id = _iSitecoreUtilities.ParseId(newsArticle.Id); var item = _iNewsReader.GetNewsItem(id); item.Delete(); }
public void UpdateNewsArticle(NewsArticle newsArticle) { var id = _iSitecoreUtilities.ParseId(newsArticle.Id); if (!id.IsNull) { var item = _iNewsReader.GetNewsItem(id); _iFieldUpdater.AddFieldsToItem(item, newsArticle); } }
public bool NewsAticleExists(NewsArticle newsArticle) { var exists = false; if (newsArticle.Id != null) { var id = _iSitecoreUtilities.ParseId(newsArticle.Id); exists = Sitecore.Data.Database.GetDatabase("master").GetItem(id) != null; } return exists; }
public NewsArticle GetNewsArticle(Item item) { var newsArticle = new NewsArticle(); var dateField = (Sitecore.Data.Fields.DateField)item.Fields["Date"]; newsArticle.Title = item["Title"]; newsArticle.Body = item["Body"]; newsArticle.Date = dateField.DateTime; newsArticle.itemId = item.ID.ToString(); newsArticle.Id = item.ID.ToString(); newsArticle.Url = item.Paths.ContentPath; return newsArticle; }