Beispiel #1
0
        public HttpResponseMessage DeletePage(DTO.PageDetails page)
        {
            var apiResponse = new DTO.ApiResponse <DTO.SavePageResponse>();

            apiResponse.CustomObject = new DTO.SavePageResponse();

            try
            {
                var tabController = new DotNetNuke.Entities.Tabs.TabController();
                var tab           = tabController.GetTab(page.Id, PortalSettings.PortalId);
                if (DotNetNuke.Security.Permissions.TabPermissionController.CanDeletePage(tab) && !DotNetNuke.Entities.Tabs.TabController.IsSpecialTab(tab.TabID, PortalSettings))
                {
                    if (tab.TabID == PortalSettings.ActiveTab.TabID)
                    {
                        apiResponse.CustomObject.Redirect = true;
                        apiResponse.CustomObject.Url      = DotNetNuke.Common.Globals.NavigateURL(PortalSettings.HomeTabId);
                    }

                    apiResponse.Success = tabController.SoftDeleteTab(tab.TabID, PortalSettings);;
                }
            }
            catch (Exception err)
            {
                apiResponse.Success = false;
                apiResponse.Message = err.Message;

                Exceptions.LogException(err);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, apiResponse));
        }