public IEnumerable<PoulePrediction> GetTablePredictions(int id)
        {
            HetEKSpelEntities db = new HetEKSpelEntities(connectionString);

            var tablePredictions = db.Predictions.Where(p => p.Participant_Id == id && p.PredictionType_Id == PredictionType.Table);
            var games = db.Games.Where(g => g.PredictionType_Id == PredictionType.Table).ToList();
            var teams = db.Teams.ToList();

            var predictionList = new List<PoulePrediction>();

            foreach (var tablePrediction in tablePredictions)
            {

                var team = teams.SingleOrDefault(t => t.Id == tablePrediction.Team_Id).Team1;
                const string result = "";
                if (games.SingleOrDefault(g => g.HomeTeam_Id == tablePrediction.Team_Id && g.PredictionType_Id == PredictionType.Table) != null )
                {
                    games.SingleOrDefault(
                        g => g.HomeTeam_Id == tablePrediction.Team_Id && g.PredictionType_Id == PredictionType.Table).
                        TablePosition.ToString();
                }

                var prediction = new PoulePrediction
                                     {
                                         Team = team,
                                         Prediction = tablePrediction.TablePosition.ToString(),
                                         Result = result,
                                         Points = tablePrediction.Points.ToString()
                                     };

                predictionList.Add(prediction);
            }

            return predictionList;
        }
        private List<PoulePrediction> GetPoulePrediction(List<Prediction> participantPredictions, List<Game> games ,IEnumerable<Team> poule )
        {
            var poulePredictionList = new List<PoulePrediction>();

            foreach (var team in poule)
            {
                var tablePrediction = participantPredictions.SingleOrDefault(p => p.PredictionType_Id == PredictionType.Table && p.Team_Id == team.Id);

                var result = "";
                if (games.SingleOrDefault(g => g.Team_Id == tablePrediction.Team_Id && g.PredictionType_Id == PredictionType.Table) != null)
                {
                   result = games.SingleOrDefault(
                        g => g.Team_Id == tablePrediction.Team_Id && g.PredictionType_Id == PredictionType.Table).
                        TablePosition.ToString();
                }

                var prediction = new PoulePrediction
                {
                    Team = team.Team1,
                    Prediction = tablePrediction.TablePosition.ToString(),
                    Result = result,
                    Points = tablePrediction.Points.ToString()
                };

                poulePredictionList.Add(prediction);
            }

            List<PoulePrediction> orderedList = new List<PoulePrediction>(poulePredictionList.OrderBy(p => p.Prediction));

            return orderedList;
        }