public void NhlHtmlReport_ParseRosterFrenchRegSeason()
        {
            string path = @"C:\Users\jordanf\Google Drive\Coding\Sportsdata\TestData\FrenchRegSeasonRoster_formatted.htm";
            string html = File.ReadAllText(path);

            Nhl_Games_Rtss_Roster model = NhlGamesRtssRoster.ParseHtmlBlob(-1, html);
        }
Exemple #2
0
 public void Script_NhlGamesRtssRoster()
 {
     NhlGamesRtssRoster.UpdateSeason(year: 2013, forceOverwrite: true);
     //DateTime fromDate = DateTime.Now.AddDays(-2);
     //NhlGamesRtssRoster.UpdateSeason(year: 2015, fromDate: fromDate, forceOverwrite: false);
 }
        public void NhlHtmlReport_ParseFrenchRegSeasonAndPersist()
        {
            string path = @"C:\Users\jordanf\Google Drive\Coding\Sportsdata\TestData\FrenchRegSeasonRoster_formatted.htm";
            string html = File.ReadAllText(path);

            Nhl_Games_Rtss_Roster model = NhlGamesRtssRoster.ParseHtmlBlob(-1, html);

            using (SportsDataContext db = new SportsDataContext())
            {
                db.Nhl_Games_Rtss_Roster_DbSet.AddOrUpdate(
                    m => m.Id,
                    model);
                db.SaveChanges();

                model = db.Nhl_Games_Rtss_Roster_DbSet.FirstOrDefault(m => m.Id == model.Id);
                model.VisitorRoster.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "visitor player 1"
                });
                model.VisitorRoster.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "visitor player 2"
                });
                model.VisitorScratches.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "visitor scratch 1"
                });
                model.VisitorScratches.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "visitor scratch 2"
                });
                model.VisitorHeadCoach.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "visitor head coach 1"
                });

                model.HomeRoster.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "home player 1"
                });
                model.HomeRoster.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "home player 2"
                });
                model.HomeScratches.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "home scratch 1"
                });
                model.HomeScratches.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "home scratch 2"
                });
                model.HomeHeadCoach.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "home head coach 1"
                });

                model.Referees.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "referee 1"
                });
                model.Referees.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "referee 2"
                });
                model.Linesman.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "linesman 1"
                });
                model.Linesman.Add(new Nhl_Games_Rtss_RosterParticipantItem {
                    Name = "linesman 2"
                });

                db.Nhl_Games_Rtss_Roster_DbSet.AddOrUpdate(
                    m => m.Id,
                    model);

                db.SaveChanges();
            }

            List <Nhl_Games_Rtss_Roster> models;

            using (SportsDataContext db = new SportsDataContext())
            {
                models = (from m in db.Nhl_Games_Rtss_Roster_DbSet
                          .Include(x => x.VisitorRoster)
                          .Include(x => x.VisitorScratches)
                          .Include(x => x.VisitorHeadCoach)
                          .Include(x => x.HomeRoster)
                          .Include(x => x.HomeScratches)
                          .Include(x => x.HomeHeadCoach)
                          .Include(x => x.Referees)
                          .Include(x => x.Linesman)
                          select m).ToList();
            }
        }