public async Task DeletePage(DeletePageInput input)
        {
            var dashboards = await GetDashboardFromSettings(input.Application);

            var dashboard = GetDashboard(dashboards, input.DashboardName);

            dashboard.Pages.RemoveAll(p => p.Id == input.Id);

            if (dashboard.Pages.Count == 0) // return to default
            {
                var defaultDashboard = (await GetDefaultDashboardValue(input.Application)).FirstOrDefault(d => d.DashboardName == input.DashboardName);

                dashboards.Remove(dashboard);
                dashboards.Add(defaultDashboard);
            }

            await SaveSetting(input.Application, dashboards);
        }
Ejemplo n.º 2
0
        public DeletePageOutput DeletePage(DeletePageInput input)
        {
            var page = _pageManager.PageRepository.FirstOrDefault(e => e.Name == input.Name);

            if (page == null)
            {
                throw new UserFriendlyException("未找到页面");
            }

            // 删除页面
            _pageManager.DeletePage(page);

            // 删除所有文章
            _pageDataManager.DeletePagePosts(page);

            // 删除组件
            _pageComponentManager.DeletePageComponents(page);

            // 删除默认数据
            _componentDataManager.DeleteDefaultComponentData(page);

            return(new DeletePageOutput());
        }
Ejemplo n.º 3
0
        public DeletePageOutput DeletePage(DeletePageInput input)
        {
            _pageManager.DeletePage(input.Name);

            return(new DeletePageOutput());
        }
Ejemplo n.º 4
0
        public DeletePageOutput DeletePage(DeletePageInput input)
        {
            _deletePageService.DeletePage(input.Name);

            return(new DeletePageOutput());
        }
Ejemplo n.º 5
0
 public void DeletePage(DeletePageInput input)
 {
     var revision = _documentRepository.Get(input.DocumentId).DraftRevision;
     var targetPage = revision.Pages.Single(p => p.Id == input.PageId);
     revision.RemovePage(targetPage);
 }