Beispiel #1
0
        /// <summary>
        /// Sets up poll:
        /// -Adds options to poll
        /// -Adds comments to Poll
        /// </summary>
        /// <returns>The new set-up poll.</returns>
        /// <param name="poll">Poll to be changed.</param>
        private static async Task <Poll> SetUpPoll(Poll poll)
        {
            Poll pollWithParts = await SharpHacker.SetParts(poll, new HttpClient());

            if (pollWithParts.ParentCommentsID == null)
            {
                pollWithParts.ParentCommentsID = new List <int>();
            }
            pollWithParts.Comments = await SharpHacker.GetComments(pollWithParts.ParentCommentsID);

            return(pollWithParts);
        }
Beispiel #2
0
        /// <summary>
        /// Sets up story:
        /// -Adds correct StoryType
        /// -Adds comments to story
        /// </summary>
        /// <returns>Newly set up story.</returns>
        /// <param name="story">Story to be changed.</param>
        private static async Task <Story> SetUpStory(Story story)
        {
            Story storyWithType = SharpHacker.SetTypeCorrectly(story);

            if (storyWithType.ParentCommentsID == null)
            {
                storyWithType.ParentCommentsID = new List <int>();
            }
            storyWithType.Comments = await SharpHacker.GetComments(storyWithType.ParentCommentsID);

            return(storyWithType);
        }