private void attach_Pages(Page entity) { this.SendPropertyChanging(); entity.Parent = this; }
private void detach_Pages(Page entity) { this.SendPropertyChanging(); entity.Parent = null; }
partial void DeletePage(Page instance);
partial void UpdatePage(Page instance);
partial void InsertPage(Page instance);
public string AddPage(string title, int? parentid) { Page lastpage; if (parentid > 0) lastpage = db.Pages.Where(pg => pg.ParentID == parentid).OrderByDescending(pg => pg.MenuOrder).FirstOrDefault(); else { lastpage = db.Pages.Where(pg => object.Equals(pg.ParentID, null)).OrderByDescending(pg => pg.MenuOrder).FirstOrDefault(); parentid = null; } int? menuOrder = 1; if (lastpage != null) menuOrder = lastpage.MenuOrder + 1; Page p = new Page(); p.Title = Server.HtmlEncode(title); p.MenuTitle = Server.HtmlEncode(title); p.Permalink = TitleToPermalink(title); p.ParentID = parentid; p.MenuOrder = menuOrder; p.DisplayInMenu = false; p.Locked = 0; p.DevelopmentID = 1; p.CreatedBy = "admin"; p.Enabled = true; p.Type = "template"; p.TemplateID = 1; PageObject po = new PageObject(); po.Page = p; po.HtmlContent = ""; po.Type = "{html_content}"; db.Pages.InsertOnSubmit(p); db.PageObjects.InsertOnSubmit(po); db.SubmitChanges(); return p.PageID.ToString(); }
private void DeletePage(Page p) { foreach (Page pg in p.Children) { DeletePage(pg); } db.PageObjects.DeleteAllOnSubmit(p.PageObjects); db.Pages.DeleteOnSubmit(p); }