Example #1
0
    /// <summary>
    /// Deletes site. Called when the "Delete site" button is pressed.
    /// Expects the CreateSite method to be run first.
    /// </summary>
    private bool DeleteSite()
    {
        // Get the site
        SiteInfo deleteSite = SiteInfoProvider.GetSiteInfo("MyNewSite");

        if (deleteSite != null)
        {
            TreeProvider treeProvider = new TreeProvider(CMSContext.CurrentUser);

            // Delete documents belonging under the site
            DocumentHelper.DeleteSiteTree("MyNewSite", treeProvider);

            // Delete the site
            SiteInfoProvider.DeleteSite(deleteSite);

            return(true);
        }

        return(false);
    }
Example #2
0
    /// <summary>
    /// Deletes site. Called when the "Delete imported site" button is pressed.
    /// Expects the ImportSite method to be run first.
    /// </summary>
    private bool DeleteImportedSite()
    {
        // Get the site
        SiteInfo deleteSite = SiteInfoProvider.GetSiteInfo("MyNewImportedSite");

        if (deleteSite != null)
        {
            TreeProvider treeProvider = new TreeProvider(MembershipContext.AuthenticatedUser);

            // Delete documents belonging under the site
            DocumentHelper.DeleteSiteTree("MyNewImportedSite", treeProvider);

            // Delete the site
            SiteInfoProvider.DeleteSite(deleteSite);

            return(true);
        }

        return(false);
    }