Exemplo n.º 1
0
 //============== Constructors =============//
 public TeamService(int id)
 {
     _id = id;
     _context = new Context();
     _team = FetchTeamById(_id, _context);
     
 }
Exemplo n.º 2
0
 private TeamGameStatistic FetchGameStatsByTeam(Team team, Game game, Context context)
 {
     var query = (from tgs in context.TeamGameStatistics
                  where (team.RefNum == tgs.TeamRefNum) && (game.RefNum == tgs.GameRefNum)
                  select tgs).Single();
     return query;
 }
Exemplo n.º 3
0
        private Conference FetchConferenceByTeam(Team team, Context context)
        {
            string conferenceRefNum = team.ConfRefNum;

            Conference query = (from conference in context.Conferences
                                where conference.RefNum == conferenceRefNum
                                select conference).Single();
            return query;
        }
 private void CheckReturnedRefNumFromTeamViewMode(TeamViewModel tvm, Team team)
 {
 }
 private void CheckReturnedTeamFromTeamViewModel(TeamViewModel tvm, Team team)
 {
     TeamViewModel test = new TeamViewModel(team.Id);
     Assert.AreEqual(team, test.Team);
 }
Exemplo n.º 6
0
 public TeamGameStatistic FetchGameStatsByTeam(Team team)
 {
     return FetchGameStatsByTeam(team, _game, _context);
 }
Exemplo n.º 7
0
        //private IEnumerable<PlayerRecord> FetchPlayerRecordsByPlayers(IEnumerable<Player> teamPlayers)
        //{
        //    ICollection<PlayerRecord> allPlayerRecords = new List<PlayerRecord>();
        //    foreach (Player player in teamPlayers)
        //    {
        //        var query = (from playerRecord in _context.PlayerRecords
        //                     where playerRecord.PlayerRefNum == player.RefNum
        //                     select playerRecord).Single();
        //        allPlayerRecords.Add(query);
        //    }
        //    return allPlayerRecords;
        //}

        //private IEnumerable<TeamRecord> FetchTeamRecordsByTeam(Team team, Context context)
        //{
        //    var query = (from teamRecord in context.TeamRecords
        //                 where teamRecord.TeamRefNum == team.RefNum
        //                 select teamRecord);
        //    return query;
        //}

        private IEnumerable<ICollection<string>> FetchGameInformationByTeam(Team team, Context context)
        {
            var Games = (from game in _context.Games
                         where game.HomeTeamRefNum == _team.RefNum || game.VisitTeamRefNum == _team.RefNum
                         select game).Distinct();

            ICollection<List<string>> gameDetail = new List<List<string>>();
            foreach (Game game in Games)
            {
                Team homeTeam = FetchByRefNum(game.HomeTeamRefNum, _context);
                Team visitTeam = FetchByRefNum(game.VisitTeamRefNum, _context);
                Stadium stadium = FetchStadiumByGame(game, _context);
                var gameInformation = new List<string>();
                gameInformation.Add(game.Date.ToString("mm/dd/yyyy"));
                gameInformation.Add(homeTeam.Name + " vs. " + visitTeam.Name + " at " + stadium.Name + " in " + stadium.City + ", " + stadium.State);
                gameInformation.Add(game.Id.ToString());
                gameDetail.Add(gameInformation);
            }
            return gameDetail;
        }
Exemplo n.º 8
0
 private IEnumerable<Player> FetchPlayersByTeam(Team team, Context context)
 {
     var query = (from player in _context.Players
                  where player.TeamRefNum == _team.RefNum
                  select player).Distinct();
     return query;
 }
Exemplo n.º 9
0
        //============ Constructors ==============//

        public TeamViewModel(int id)
        {
            _teamService = new TeamService(id);
            _team = _teamService.Team();
        }