public BoardGameGeekInfo LookUpBoardGame(long id) { XmlNode gameNode = engine.RequestGameDetails(id); if (gameNode == null) { // If this happens, something really funky is going on throw new Exception("Error retrieving game. Invalid id or no associated data."); } BoardGameGeekInfo info = new BoardGameGeekInfo(); foreach (XmlNode node in gameNode.SelectNodes("name")) { if (node.Attributes["primary"] != null && node.Attributes["primary"].Value == "true") { info.Name = node.InnerText; } } info.BggId = id; info.Link = "https://boardgamegeek.com/boardgame/" + id; info.Description = gameNode.SelectSingleNode("description").InnerText; info.ImageLink = gameNode.SelectSingleNode("thumbnail").InnerText; info.MinPlayers = Convert.ToInt32(gameNode.SelectSingleNode("minplayers").InnerText); info.MaxPlayers = Convert.ToInt32(gameNode.SelectSingleNode("maxplayers").InnerText); info.MinPlayingTime = Convert.ToInt32(gameNode.SelectSingleNode("minplaytime").InnerText); info.MaxPlayingTime = Convert.ToInt32(gameNode.SelectSingleNode("maxplaytime").InnerText); XmlNode statistics = gameNode.SelectSingleNode("statistics").SelectSingleNode("ratings"); info.Rating = Convert.ToDouble(statistics.SelectSingleNode("average").InnerText); info.NumRatings = Convert.ToInt64(statistics.SelectSingleNode("usersrated").InnerText); string ranking = statistics.SelectSingleNode("ranks").SelectSingleNode("rank").Attributes["value"].Value; if (ranking != "Not Ranked") { info.Rank = Convert.ToInt32(statistics.SelectSingleNode("ranks").SelectSingleNode("rank").Attributes["value"].Value); } return info; }
public void AddInfo(BoardGameGeekInfo gameInfo) { bggRepo.InsertBoardGameGeekInfo(gameInfo); }
public void UpdateBoardGameGeekInfo(BoardGameGeekInfo game) { context.Entry(game).State = EntityState.Modified; }
public void RemoveInfo(BoardGameGeekInfo bggInfo) { bggRepo.DeleteBoardGameGeekInfo(bggInfo.Id); }
public void InsertBoardGameGeekInfo(BoardGameGeekInfo game) { context.BoardGameGeekInfo.Add(game); }