public void AddPlayer(Player player, string connectionString) { using (BennetBasketballDb db = new BennetBasketballDb(connectionString)) { db.Players.Add(player); db.SaveChanges(); } }
public void AddRegistration(Guardian guardian, Player player, string connectionString) { int? guardianId = guardian.Id; if (guardianId == null) { GuardianAccessor guardianAccessor = new GuardianAccessor(); guardianId=guardianAccessor.AddGuardian(guardian, connectionString); } PlayerAccessor playerAccessor = new PlayerAccessor(); player.GuardianId = guardianId; playerAccessor.AddPlayer(player, connectionString); }