public static ContentItem ProjectContentItem(OxiteCMSDataContext context, oxite_CMS_ContentItem ci) { return (new ContentItem( ci.ContentItemID, new SiteSmall(ci.SiteID), projectPage(context, ci.PageID), ci.ContentItemName, ci.ContentItemDisplayName, ci.Body, ci.Version, new UserAuthenticated(ci.oxite_User.UserID, ci.oxite_User.Username, ci.oxite_User.DisplayName), ci.CreatedDate, ci.PublishedDate )); }
internal static ContentItem SaveContentItem(OxiteCMSDataContext context, ContentItem contentItem) { oxite_CMS_ContentItem item = contentItem.Page != null ? context.oxite_CMS_ContentItems.Where(ci => ci.SiteID == contentItem.Site.ID && ci.PageID == contentItem.Page.ID && string.Compare(ci.ContentItemName, contentItem.Name, true) == 0).OrderByDescending(ci => ci.Version).FirstOrDefault() : context.oxite_CMS_ContentItems.Where(ci => ci.SiteID == contentItem.Site.ID && ci.PageID == null && string.Compare(ci.ContentItemName, contentItem.Name, true) == 0).OrderByDescending(ci => ci.Version).FirstOrDefault(); short version; if (item != null) { if (item.Body == contentItem.Body) { return(null); } version = item.Version; version++; } else { version = 1; } item = new oxite_CMS_ContentItem { SiteID = contentItem.Site.ID, PageID = contentItem.Page != null ? (Guid?)contentItem.Page.ID : (Guid?)null, ContentItemID = contentItem.ID != Guid.Empty ? contentItem.ID : Guid.NewGuid(), ContentItemName = contentItem.Name, ContentItemDisplayName = contentItem.DisplayName, Body = contentItem.Body, CreatedDate = DateTime.UtcNow, CreatorUserID = contentItem.Creator.ID, PublishedDate = contentItem.Published, Version = version }; context.oxite_CMS_ContentItems.InsertOnSubmit(item); context.SubmitChanges(); return(GetContentItem(context, item.SiteID, item.ContentItemName)); }
private void detach_oxite_CMS_ContentItems(oxite_CMS_ContentItem entity) { this.SendPropertyChanging(); entity.oxite_User = null; }
private void attach_oxite_CMS_ContentItems(oxite_CMS_ContentItem entity) { this.SendPropertyChanging(); entity.oxite_CMS_Page = this; }
partial void Deleteoxite_CMS_ContentItem(oxite_CMS_ContentItem instance);
partial void Updateoxite_CMS_ContentItem(oxite_CMS_ContentItem instance);
partial void Insertoxite_CMS_ContentItem(oxite_CMS_ContentItem instance);