Exemplo n.º 1
0
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newPlayer = new Player()
                {
                    UserName = "******",
                    Email = "*****@*****.**",
                    HeightFeet = 6,
                    HeightInches = 4,
                    Position = "Shooting Guard"
                };
                await _userManager.CreateAsync(newPlayer, "P@ssw0rd!");
            }

            if (!_context.Games.Any())
            {
                var game1 = new Game()
                {
                    Order = 1,
                    Opponent = "Warriors"
                };
                _context.Games.Add(game1);
                var game2 = new Game()
                {
                    Order = 2,
                    Opponent = "Spurs"
                };
                _context.Games.Add(game2);
                var game3 = new Game()
                {
                    Order = 3,
                    Opponent = "Bulls"
                };
                _context.Games.Add(game3);
                _context.SaveChanges();
            }

            if (!_context.Stats.Any())
            {
                var statLine1 = new StatLine()
                {
                    GameNumber = 1,
                    Opponent = "Warriors",
                    Player = "jasonholdridge",
                    Points = 11,
                    FieldGoals = 3,
                    FieldGoalsAttempted = 5,
                    FGPercentage = 0.6,
                    Assists = 2,
                    Rebounds = 8
                };
                _context.Stats.Add(statLine1);
                var statLine2 = new StatLine()
                {
                    GameNumber = 2,
                    Opponent = "Spurs",
                    Player = "jasonholdridge",
                    Points = 25,
                    FieldGoals = 12,
                    FieldGoalsAttempted = 36,
                    FGPercentage = 0.333,
                    Assists = 1,
                    Rebounds = 15
                };
                _context.Stats.Add(statLine2);
                var statLine3 = new StatLine()
                {
                    GameNumber = 3,
                    Opponent = "Bulls",
                    Player = "stevesmith",
                    Points = 18,
                    FieldGoals = 5,
                    FieldGoalsAttempted = 10,
                    FGPercentage = 0.5,
                    Assists = 5,
                    Rebounds = 17
                };
                _context.Stats.Add(statLine3);
                _context.SaveChanges();
            }
        }
Exemplo n.º 2
0
 public void AddStatLine(StatLine newStatLine)
 {
     //newStatLine.Player = "cbusjay";
     _context.Add(newStatLine);
 }