Exemplo n.º 1
0
    /// <summary>
    /// Removes module from site. Called when the "Remove module from site" button is pressed.
    /// Expects the AddModuleToSite method to be run first.
    /// </summary>
    private bool RemoveModuleFromSite()
    {
        // Get the module
        ResourceInfo removeModule = ResourceInfoProvider.GetResourceInfo("MyNewModule");

        if (removeModule != null)
        {
            int siteId = SiteContext.CurrentSiteID;

            // Get the binding
            ResourceSiteInfo moduleSite = ResourceSiteInfoProvider.GetResourceSiteInfo(removeModule.ResourceId, siteId);

            // Delete the binding
            ResourceSiteInfoProvider.DeleteResourceSiteInfo(moduleSite);

            return(true);
        }

        return(false);
    }