public static SearchGameViewModel ConvertGeekGameSearchToGameViewModel(BoardGameGeekSearchResult bgg)
        {
            SearchGameViewModel gvm = new SearchGameViewModel
            {
                GeekID=bgg.GeekID,
                Name=bgg.Name,
                Selected=false
            };

            return gvm;
        }
Exemplo n.º 2
0
        public static IEnumerable<BoardGameGeekSearchResult> SearchGeekForGame(string gameName)
        {
            List<BoardGameGeekSearchResult> collection = new List<BoardGameGeekSearchResult>();

            string queryURL = string.Format("{0}{1}{2}", BASE_URL, SEARCH_URL, gameName);
            XDocument xml = WebHelpers.GetXMLFromServer(queryURL);
            //Need to inform caller of progress of task
            var gameEntries = xml.Root.Elements("boardgame");
            foreach (var gameEntry in gameEntries)
            {
                BoardGameGeekSearchResult result=new BoardGameGeekSearchResult{
                    GeekID=gameEntry.Attribute("objectid").Value,
                    Name=gameEntry.Element("name").Value
                };

                collection.Add(result);
            }
            return collection;
        }