コード例 #1
0
        public int AddGuardian(Guardian guardian, string connectionString)
        {
            int id;
            using (BennetBasketballDb db = new BennetBasketballDb(connectionString))
            {
                db.Guardians.Add(guardian);
                db.SaveChanges();
                id = guardian.Id;

            }
            return id;
        }
コード例 #2
0
        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);
        }