private void detach_PageObjects(PageObject entity) { this.SendPropertyChanging(); entity.Page = null; }
private void attach_PageObjects(PageObject entity) { this.SendPropertyChanging(); entity.Page = this; }
partial void DeletePageObject(PageObject instance);
partial void UpdatePageObject(PageObject instance);
partial void InsertPageObject(PageObject 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(); }