public PageApplicationView Save(PageApplicationView item) { return(new PageApplicationViewRepository().SaveOrUpdate(item)); }
private void SavePage() { if (SecurityContextManager.Current.CurrentURL.Contains("/edit")) { this.CurrentPage.IsExternal = cbIsExternal.Checked; this.CurrentPage.IsActive = cbOnline.Checked; this.CurrentPage.ChangedBy = SecurityContextManager.Current.CurrentUser.ID; this.CurrentPage.DisplayName = tbName.Text; this.CurrentPage.ExternalURL = tbExternalURL.Text; this.CurrentPage.LastUpdated = DateTime.Now; this.CurrentPage.Name = tbName.Text.Replace("&", "").Replace("'", "").Replace("?", "").Replace("@", "").Replace("$", "").Replace("#", ""); this.CurrentPage.SEODescription = tbSeoDescription.Text; this.CurrentPage.SEOKeywords = tbSeoKeywords.Text; this.CurrentPage.SEOTitle = tbSeoTitle.Text; if (radAsyncUpload.UploadedFiles.Count > 0) { UploadedFile file = radAsyncUpload.UploadedFiles[0]; string filePath = DateTime.Now.Ticks.ToString() + "_" + file.FileName; //string filePath = file.FileName; file.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["IMAGEURL"]) + filePath, false); this.CurrentPage.HeaderImagePath = ConfigurationManager.AppSettings["IMAGEURL"] + filePath; } var content = new PageContentServices().GetByPageID(this.CurrentPage.ID); content.PageData = reContent.Content; content.Title = tbTitle.Text; content.SubTitle = tbSubTitle.Text; content.LastUpdated = DateTime.Now; content.ChangedBy = SecurityContextManager.Current.CurrentUser.ID; new PageServices().Save(this.CurrentPage); new PageContentServices().Save(content); Response.Redirect(SecurityContextManager.Current.CurrentURL); } else { var p = new IdeaSeedCMS.Core.Domain.Page(); p.IsActive = cbOnline.Checked; p.AccessLevel = 0; p.ChangedBy = SecurityContextManager.Current.CurrentUser.ID; p.DateCreated = DateTime.Now; p.DisplayName = tbName.Text; p.EnteredBy = SecurityContextManager.Current.CurrentUser.ID; p.ExternalURL = tbExternalURL.Text; if (radAsyncUpload.UploadedFiles.Count > 0) { UploadedFile file = radAsyncUpload.UploadedFiles[0]; string filePath = DateTime.Now.Ticks.ToString() + "_" + file.FileName; //string filePath = file.FileName; file.SaveAs(Server.MapPath(ConfigurationManager.AppSettings["IMAGEURL"]) + filePath, false); p.HeaderImagePath = ConfigurationManager.AppSettings["IMAGEURL"] + filePath; } p.IsExternal = cbIsExternal.Checked; p.LastUpdated = DateTime.Now; p.MarkedForDeletion = false; p.Name = tbName.Text.Replace("&", "").Replace("'", "").Replace("?", "").Replace("@", "").Replace("$", "").Replace("#", ""); p.PageTypeID = (int)PageType.PROFILE; if (SecurityContextManager.Current.CurrentURL.Contains("/add")) { p.ParentID = ((IdeaSeedCMS.Core.Domain.Page)SecurityContextManager.Current.CurrentPage).ID; p.NavigationTypeID = (int)NavigationType.NONE; } else { p.NavigationTypeID = (int)NavigationType.MAIN; } p.SEODescription = tbSeoDescription.Text; p.SEOKeywords = tbSeoKeywords.Text; p.SEOTitle = tbSeoTitle.Text; p.URLRoute = "/Default.aspx"; p.ApplicationID = Convert.ToInt16(SecurityContextManager.Current.CurrentManagedApplication.ID); new PageServices().Save(p); var pav = new PageApplicationView(); pav.ApplicationViewID = Convert.ToInt16(ConfigurationManager.AppSettings["DEFAULTAPPLICATIONVIEWID"]); pav.PageID = p.ID; pav.ViewLayout = ApplicationViewLayout.MAIN; pav.SortOrder = 0; new PageViewServices().Save(pav); var content = new PageContent(); content.PageData = reContent.Content; content.Title = tbTitle.Text; content.SubTitle = tbSubTitle.Text; content.LastUpdated = DateTime.Now; content.ChangedBy = SecurityContextManager.Current.CurrentUser.ID; content.DateCreated = DateTime.Now; content.EnteredBy = SecurityContextManager.Current.CurrentUser.ID; content.PageID = p.ID; new PageContentServices().Save(content); Response.Redirect(SecurityContextManager.Current.CurrentURL.Replace("New", p.ID.ToString() + "/edit")); } //HttpContext.Current.Cache.Remove(ResourceStrings.Cache_PrimaryPublicNavData); //Context.Cache.Insert(ResourceStrings.Cache_PrimaryPublicNavData, new PageServices().GetByNavigationTypeID(1, Convert.ToInt16(ConfigurationManager.AppSettings["APPLICATIONID"]))); }