Exemplo n.º 1
0
        private static List <Nhl_Players_Rtss_Skater> UpdateSeason(int year, NhlSeasonType nhlSeasonType, bool saveToDb)
        {
            // Get HTML rows
            NhlPlayersRtssSkater nhl  = new NhlPlayersRtssSkater();
            List <HtmlNode>      rows = nhl.GetResultsForSeasonType(year, nhlSeasonType);

            // Parse into a list
            List <Nhl_Players_Rtss_Skater> results = new List <Nhl_Players_Rtss_Skater>();

            foreach (HtmlNode row in rows)
            {
                Nhl_Players_Rtss_Skater result = NhlPlayersRtssSkater.MapHtmlRowToModel(row, nhlSeasonType, year);

                if (null != result)
                {
                    results.Add(result);
                }
            }

            // Update DB
            if (saveToDb)
            {
                NhlPlayersRtssSkater.AddOrUpdateDb(results);
            }

            return(results);
        }
Exemplo n.º 2
0
        public static List <Nhl_Players_Rtss_Skater> GetFullSeason(int year, [Optional] bool saveToDb)
        {
            List <Nhl_Players_Rtss_Skater> results = new List <Nhl_Players_Rtss_Skater>();

            foreach (NhlSeasonType seasonType in Enum.GetValues(typeof(NhlSeasonType)))
            {
                if (seasonType == NhlSeasonType.None)
                {
                    continue;
                }

                List <Nhl_Players_Rtss_Skater> partialResults = NhlPlayersRtssSkater.UpdateSeason(year, seasonType, saveToDb);
                if (null != partialResults)
                {
                    results.AddRange(partialResults);
                }
            }

            return(results);
        }
Exemplo n.º 3
0
        private static List<Nhl_Players_Rtss_Skater> UpdateSeason(int year, NhlSeasonType nhlSeasonType, bool saveToDb)
        {
            // Get HTML rows
            NhlPlayersRtssSkater nhl = new NhlPlayersRtssSkater();
            List<HtmlNode> rows = nhl.GetResultsForSeasonType(year, nhlSeasonType);

            // Parse into a list
            List<Nhl_Players_Rtss_Skater> results = new List<Nhl_Players_Rtss_Skater>();
            foreach (HtmlNode row in rows)
            {
                Nhl_Players_Rtss_Skater result = NhlPlayersRtssSkater.MapHtmlRowToModel(row, nhlSeasonType, year);

                if (null != result)
                {
                    results.Add(result);
                }
            }

            // Update DB
            if (saveToDb)
            {
                NhlPlayersRtssSkater.AddOrUpdateDb(results);
            }

            return results;
        }