public Tournament GetByID(int id) { var tournament = _tournamentRepository.GetById(id); tournament.FederationPaticipate = _federationRepository.GetFederationInTournament(id); tournament.Rounds = _roundRepository.GetListRoundByTournament(id); tournament.ChildenTournament = _tournamentRepository.GetAllChildTournament(id); if (tournament.ChildenTournament != null && tournament.ChildenTournament.Count() != 0) { tournament.ChildenTournament = GetStatisticPlayerInChildTour(tournament.ChildenTournament); } else { tournament.StatisticPlayer = _playerRepository.GetListPlayerHigherMarkInTournament(id); } return(tournament); }
public Tournament GetById(int id) { var parameter = new { Id = id.ToString(), }; using (var objectDb = ObjectDbFactory.CreateInstance("GetSingle")) { var tournament = objectDb.Query <Tournament, Federation, Tournament>( (tournaments, federation) => { tournaments.Federation = federation; return(tournaments); }, "FederationID", parameter).FirstOrDefault(); tournament.FederationPaticipate = _federationRepository.GetFederationInTournament(id); tournament.Rounds = _roundRepository.GetListRoundByTournament(id); return(tournament); } }
public IEnumerable <Federation> GetFederationInTournament(int id) { return(_federationRepository.GetFederationInTournament(id)); }