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

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

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

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

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

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

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

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

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

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

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

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

            return results;
        }