// POST api/<controller> public void PostTeam(Team team) { try { string connectionString = Properties.Settings.Default.FreeFootieConnectionString; using (FreeFootieDataContext myData = new FreeFootieDataContext(connectionString)) { using (TransactionScope myScope = new TransactionScope()) { team newTeam = new team(); var newID = (from c in myData.teams select c.id).Max(); newTeam.id = newID + 1; newTeam.name = team.name; newTeam.coach = team.coach; newTeam.losses = team.loses; newTeam.wins = team.wins; newTeam.ties = team.ties; newTeam.phone = team.phone; newTeam.schoolID = team.school; myData.teams.InsertOnSubmit(newTeam); foreach (int playerID in team.palyers) { teamPlayer newTeamPlayer = new teamPlayer(); newTeamPlayer.teamID = newTeam.id; newTeamPlayer.playerID = playerID; myData.teamPlayers.InsertOnSubmit(newTeamPlayer); } myData.SubmitChanges(); myScope.Complete(); } } } catch (Exception ex) { Common.ErrorCatch(ex, "TeamController.PostTeam"); } }
private void detach_teamPlayers(teamPlayer entity) { this.SendPropertyChanging(); entity.player = null; }
private void attach_teamPlayers(teamPlayer entity) { this.SendPropertyChanging(); entity.player = this; }
partial void DeleteteamPlayer(teamPlayer instance);
partial void UpdateteamPlayer(teamPlayer instance);
partial void InsertteamPlayer(teamPlayer instance);