Пример #1
0
 private Stadium FetchStadiumByGame(Game game, Context context)
 {
     var query = (from stadium in context.Stadiums
                  where stadium.RefNum == game.StadiumRefNum
                  select stadium).SingleOrDefault();
     return query;
 }
Пример #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;
 }
Пример #3
0
        //============ Constructors =================//

        public GameService(int id)
        {
            _context = new Context();
            _id = id;
            _gameStat = GameStatistic(_id, _context);
            _game = FetchGameByGameStatistic(_gameStat);
        }
Пример #4
0
 private Team FetchTeamByGame(string homeOrVistior, Game game, Context context)
 {
     if (homeOrVistior == "home")
     {
         var query = (from team in context.Teams
                      where team.RefNum == game.HomeTeamRefNum
                      select team).Single();
         return query;
     }
     if (homeOrVistior == "visitor")
     {
         var query = (from team in context.Teams
                      where team.RefNum == game.VisitTeamRefNum
                      select team).Single();
         return query;
     }
     else
     {
         throw new ArgumentException("The method - FetchTeamByGame() in GameService.cs - requires the string to contain either home or visitor");
     }
 }