Esempio n. 1
0
 public static SkaterSeasonDto Create(SkaterSeason source) =>
 AutoMapper.Mapper.Map <SkaterSeasonDto>(source);
Esempio n. 2
0
 public new static SkaterSeasonFullDto Create(SkaterSeason source) =>
 AutoMapper.Mapper.Map <SkaterSeasonFullDto>(source);
Esempio n. 3
0
        private void AddSkaters()
        {
            Skater previousSkater = new Skater()
            {
                Name = ""
            };
            SkaterSeason previousSeason = new SkaterSeason();

            foreach (var skaterRow in season.SkaterRows)
            {
                Skater dbSkater = GetSkaterFromRow(previousSkater, skaterRow);

                int          i = 0;
                SkaterSeason dbSkaterSeason = new SkaterSeason()
                {
                    Skater              = dbSkater,
                    League              = league,
                    Season              = season.SeasonNumber,
                    isPlayoffs          = season.IsPlayoffs,
                    GamesPlayed         = skaterRow.Stats[i++],
                    Goals               = skaterRow.Stats[i++],
                    Assists             = skaterRow.Stats[i++],
                    Points              = skaterRow.Stats[i++],
                    PlusMinus           = skaterRow.Stats[i++],
                    PenaltyMinutes      = skaterRow.Stats[i++],
                    PenaltyMajors       = skaterRow.Stats[i++],
                    Hits                = skaterRow.Stats[i++],
                    HitsTaken           = skaterRow.Stats[i++],
                    Shots               = skaterRow.Stats[i++],
                    OwnShotsBlocked     = skaterRow.Stats[i++],
                    OwnShotsMissed      = skaterRow.Stats[i++],
                    ShotsBlocked        = skaterRow.Stats[i++],
                    MinutesPlayed       = skaterRow.Stats[i++],
                    PPGoals             = skaterRow.Stats[i++],
                    PPAssists           = skaterRow.Stats[i++],
                    PPPoints            = skaterRow.Stats[i++],
                    PPShots             = skaterRow.Stats[i++],
                    PPMinutes           = skaterRow.Stats[i++],
                    PKGoals             = skaterRow.Stats[i++],
                    PKAssists           = skaterRow.Stats[i++],
                    PKPoints            = skaterRow.Stats[i++],
                    PKShots             = skaterRow.Stats[i++],
                    PKMinutes           = skaterRow.Stats[i++],
                    GameWinningGoals    = skaterRow.Stats[i++],
                    GameTyingGoals      = skaterRow.Stats[i++],
                    FaceoffsTotal       = skaterRow.Stats[i++],
                    EmptyNetGoals       = skaterRow.Stats[i++],
                    HatTricks           = skaterRow.Stats[i++],
                    PenaltyShotGoals    = skaterRow.Stats[i++],
                    PenaltyShotAttempts = skaterRow.Stats[i++],
                    FightsWon           = skaterRow.Stats[i++],
                    FightsLost          = skaterRow.Stats[i++],
                    FightsDraw          = skaterRow.Stats[i++],
                    FaceoffWins         = skaterRow.Stats[i++],
                };

                dbSkaterSeason.Team = (skaterRow.TeamAcronym != null) ?
                                      teams.First(a => a.Acronym == skaterRow.TeamAcronym) : null;

                if (skaterRow.IsSubTotal)
                {
                    dbSkaterSeason.SubtotalFor = previousSeason;
                }
                else
                {
                    previousSkater = dbSkater;
                    previousSeason = dbSkaterSeason;
                }

                db.SkaterSeasons.Add(dbSkaterSeason);
            }
        }