public List<LEAGUE> AllLeagues(string xml) { var leagues = new List<LEAGUE>(); var leaguesNodes = new List<XmlNode>(); var xmlLeagues = new XmlDocument(); xmlLeagues.LoadXml(xml); var el = xmlLeagues.DocumentElement; var nodelist = el.ChildNodes; for (var i = 0; i < nodelist.Count; i++) { if (nodelist[i].Name == "League") { leaguesNodes.Add(nodelist[i]); } } foreach (var node in leaguesNodes) { var nodeEl = XElement.Parse(node.OuterXml); var tempLeague = new LEAGUE { API_LEAGUE_ID = Convert.ToInt32(nodeEl.XPathSelectElement("//*[local-name()='Id']").Value), COUNTRY = nodeEl.XPathSelectElement("//*[local-name()='Country']").Value, LEAGUE_NAME = nodeEl.XPathSelectElement("//*[local-name()='Name']").Value, LATEST_MATCH_DATE = DateTime.Parse(nodeEl.XPathSelectElement("//*[local-name()='LatestMatch']").Value) }; leagues.Add(tempLeague); } return leagues; }
partial void DeleteLEAGUE(LEAGUE instance);
partial void UpdateLEAGUE(LEAGUE instance);
partial void InsertLEAGUE(LEAGUE instance);