Ejemplo n.º 1
0
        public ActionResult MatchGuessStatistic(int matchId)
        {
            List <Guess> guesses = DatabaseManager.GetGuessesByMatchByGuessGame(matchId, 1);
            Match        match   = DatabaseManager.GetMatchById(matchId, true);

            MatchGuessModel model = ModelHelper.CreateMatchGuessModel(guesses, match);

            return(PartialView("_MatchGuessStatistic", model));
        }
Ejemplo n.º 2
0
        public static MatchGuessModel CreateMatchGuessModel(List <Guess> guesses, Match match)
        {
            MatchGuessModel model = new MatchGuessModel();

            model.HomeTeamName = match.Team1.Name;
            model.AwayTeamName = match.Team.Name;
            model.HomeScore    = match.HomeScore.HasValue ? match.HomeScore.Value.ToString() : "";
            model.AwayScore    = match.AwayScore.HasValue ? match.AwayScore.Value.ToString() : "";

            foreach (var guess in guesses)
            {
                if (match.HomeScore.HasValue)
                {
                    switch (GetGuessType(guess, match))
                    {
                    case GuessType.TT:
                        model.GuessList.ElementAt(0).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.MKCSG:
                        model.GuessList.ElementAt(1).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.MKGK:
                        model.GuessList.ElementAt(2).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.MKGKD:
                        model.GuessList.ElementAt(3).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.MKOG:
                        model.GuessList.ElementAt(4).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.MK:
                        model.GuessList.ElementAt(5).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.CSG:
                        model.GuessList.ElementAt(6).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.OG:
                        model.GuessList.ElementAt(7).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    case GuessType.NONE:
                        model.GuessList.ElementAt(8).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    model.GuessList.ElementAt(0).Add(GetShortUserName(guess.User.UserName) + " (" + guess.HomeScore + "-" + guess.AwayScore + ")");
                }
            }

            return(model);
        }