コード例 #1
0
    /// <summary>
    /// Removes poll from site. Called when the "Remove poll from site" button is pressed.
    /// Expects the AddPollToSite method to be run first.
    /// </summary>
    private bool RemovePollFromSite()
    {
        int siteId = SiteContext.CurrentSiteID;

        // Get the poll
        PollInfo removePoll = PollInfoProvider.GetPollInfo("MyNewPoll", siteId);

        if (removePoll != null)
        {
            // Remove poll from site
            PollSiteInfoProvider.RemovePollFromSite(removePoll.PollID, siteId);

            return(true);
        }

        return(false);
    }
コード例 #2
0
    /// <summary>
    /// Adds poll to site. Called when the "Add poll to site" button is pressed.
    /// Expects the CreatePoll method to be run first.
    /// </summary>
    private bool AddPollToSite()
    {
        int siteId = SiteContext.CurrentSiteID;

        // Get the poll
        PollInfo poll = PollInfoProvider.GetPollInfo("MyNewPoll", siteId);

        if (poll != null)
        {
            int pollId = poll.PollID;

            // Save the binding
            PollSiteInfoProvider.AddPollToSite(pollId, siteId);

            return(true);
        }

        return(false);
    }