private Page CreatePage(string title, string content, string pageKey, int? parentPageId, bool isOverridden, int? rootPageId, string rootPageKey = null) { var page = new Page(); page.Title = title; page.Content = content; page.RouteKey = pageKey; page.IsOverridden = isOverridden; if (parentPageId.HasValue) page.ParentPageId = parentPageId.Value; if (!String.IsNullOrWhiteSpace(rootPageKey)) { page.RootPageKey = rootPageKey; } else if (rootPageId.HasValue) { var pagesRepository = _repositoryFactory.GetPagesRepository(); rootPageKey = pagesRepository.GetById(rootPageId.Value).RouteKey; page.RootPageKey = rootPageKey; } return page; }
private void SavePage(Page page) { var pagesRepository = _repositoryFactory.GetPagesRepository(); using (new UnitOfWork(EntitiesContext.Current)) { pagesRepository.Add(page); } }