/// ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- /// <name>AddNewAthlete</name> /// <date>14/03/15</date> /// <summary> /// Adds a new club and resets the NewClub property. /// </summary> /// ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- public void AddNewAthlete() { ObservableCollection <string> newNumbers = new ObservableCollection <string>() { this.NewRaceNumber }; // TODO, we're not recording DOB, can this be removed, or default numbers added. AthleteType newAthlete = new AthleteType( 0, NewName, NewClub, NewSex, newNumbers, this.NewBirthYear, this.NewBirthMonth, this.NewBirthDay, false, true, this.NewInitialHandicap) { Status = StatusType.Added }; this.athleteCollection.Add(newAthlete); NewName = string.Empty; NewClub = string.Empty; NewInitialHandicap = string.Empty; NewSex = SexType.Male; this.ResetSelectedIndex(); this.UpdateNextRunningNumber(); this.RaisePropertyChangedEvent(nameof(this.AthleteCollection)); this.RaisePropertyChangedEvent(nameof(this.FilteredAthleteCollection)); }
public List <TeamAthlete> CreateAthletes(List <TeamAthlete> athletes, int gameId, int teamId, AthleteType player) { foreach (TeamAthlete a in athletes) { a.teamId = teamId; var athlete = CreateAthlete(a); var teamAthlete = new TeamAthlete { athleteId = athlete.id, teamId = teamId, role = AthleteType.Player.ToString() }; db.teamAthletes.Add(teamAthlete); db.SaveChanges(); var gameAthlete = new GameAthlete { athleteId = athlete.id, gameId = gameId }; db.gameAthletes.Add(gameAthlete); db.SaveChanges(); } return(athletes); }