public int AddPlayer(int teamId, int matchId, string name) { PlayerEntity player = new PlayerEntity { Name = name, TeamId = teamId, TeamName = Access.TeamService.GetTeam(teamId).Name, MatchId = matchId, RunsTaken = 0, BallsPlayed = 0, Fours = 0, Sixes = 0, HowOut = "not out", RunsGiven = 0, BallsBowled = 0, Wickets = 0, Maiden = 0, NoBalls = 0, Wides = 0, Catches = 0, Stumpings = 0, Thisoverballs = 0, Thisoverruns = false }; return(PlayersTable.AddPlayer(player)); }
private void OnCreatePlayerButtonClicked() { if (string.IsNullOrEmpty(nameInputField.text)) { return; } var createdPlayer = playersTable.AddPlayer(nameInputField.text); if (createdPlayer == null) { //TODO show error message return; } _createPlayerAction.Invoke(createdPlayer); }