Пример #1
0
 public ReturnStoryModel(RetrieveStoryModel rSM, int rank)
 {
     this.Title       = rSM.Title;
     this.Url         = rSM.Url;
     this.Author      = rSM.Author;
     this.Score       = rSM.Score;
     this.Descendants = rSM.Descendants;
     this.rank        = rank;
 }
Пример #2
0
        public void returnStoryModels(int numberOfStories)
        {
            /*
             * This Method populates the storyList with the request number of ReturnStoryModel classes
             * that can then be seralized into a json object to output to a file
             */
            List <string> topStories = getObejctFromAPI <List <string> >(topStoriesURL);

            int returnStories       = 1;
            int retrieveStoryNumber = 0;

            while (returnStories <= numberOfStories)
            {
                RetrieveStoryModel retrieveStoryModel = getStoryJson(topStories[retrieveStoryNumber]);
                retrieveStoryNumber++;

                if (retrieveStoryModel.testStory())
                {
                    ReturnStoryModel returnStoryModel = new ReturnStoryModel(retrieveStoryModel, returnStories);
                    storyList.Add(returnStoryModel);
                    returnStories++;
                }
            }
        }