Example #1
0
        public int pullXMLbyIDSaveToDBAndTweetAboutIt(string apiKey)
        {
            try
            {
                var API  = new APIAccessor_boardgamegeek_BoardGame();
                var BC   = new RawGamesAccessor();
                var twit = new TwitterApiAccessor("iNbJLSc1T9fvufuWbFV3V6Xni", "JFjvyyhz56ZvZR1IkGjNSXNBThUT31OUrn43LXMQkCdNyy2CpK", "749359779592613888-wWPrZIls1xVFprjqRunSpKEr5GgaXDp", "rRHz1DhGR9kJ8DwwMjGuMj3uWn9z0t1IIp3YAYDlL4FKm");

                var xml = API.getBoardGame(apiKey.ToString());

                var newGame = new RawGame();

                newGame.APIID   = apiKey;
                newGame.TheBlob = xml;

                BC.UpdateOrCreate(newGame);

                twit.SendTweet("Someone posted information about Game ID: " + newGame.APIID + " from BGG - " + DateTime.Now.ToString("yyyyMMdd-hhmmss"));

                return(100);
            }
            catch (Exception e)
            {
                return(499);
            }
        }
Example #2
0
        public string pullXMLbyIDAndSaveToDatabase(string apiKey)
        {
            try {
                var API = new APIAccessor_boardgamegeek_BoardGame();
                var BC  = new RawGamesAccessor();

                var xml = API.getBoardGame(apiKey.ToString());

                var newGame = new RawGame();

                newGame.APIID   = apiKey;
                newGame.TheBlob = xml;

                BC.UpdateOrCreate(newGame);

                return("Done!");
            }
            catch {
                return("Error");
            }
        }