Ejemplo n.º 1
0
 public void AddPlayer(Player player)
 {
     using (var context = new HockeyContext())
     {
         //context.Database.Log = s => Debug.WriteLine(s);
         //if (player.Position?.Name != null && player.Position.Id == 0)
         //    player.Position = context.Positions.FirstOrDefault(p => p.Name == player.Position.Name);
         context.Players.Add(player);
         context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void AddPlayerTest()
 {
     var player = new Player { FirstName = "first", LastName = "last", Positions = new List<Position> { new Position { Name = "Goalie" } } };
     var repo = new HockeyRepo();
     repo.AddPlayer(player);
 }