Beispiel #1
0
        public virtual ActionResult Details(int id, ApplicationUser currentUser)
        {
            var player = playerRetriever.GetPlayerDetails(id, NUMBER_OF_RECENT_GAMES_TO_RETRIEVE);

            var fullUrl = Url.Action(MVC.Player.ActionNames.Details, MVC.Player.Name, new { id }, Request.Url.Scheme) + "#minions";
            var playerDetailsViewModel = playerDetailsViewModelBuilder.Build(player, fullUrl, currentUser);

            ViewBag.RecentGamesMessage = showingXResultsMessageBuilder.BuildMessage(
                NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                player.PlayerGameResults.Count);

            return(View(MVC.Player.Views.Details, playerDetailsViewModel));
        }
Beispiel #2
0
        public virtual ActionResult Details(int id, ApplicationUser currentUser)
        {
            var player = playerRetriever.GetPlayerDetails(id, NUMBER_OF_RECENT_GAMES_TO_RETRIEVE);

            var fullUrl = Url.Action(MVC.Player.ActionNames.Details, MVC.Player.Name, new { id }, Request.Url.Scheme) + "#minions";

            var playerIds = player.PlayerVersusPlayersStatistics.Select(x => x.OpposingPlayerId).ToList();

            //--include the current player so we can attempt to get their email address as well
            playerIds.Add(id);
            var playerIdToRegisteredUserEmailAddressDictionary =
                playerRetriever.GetRegisteredUserEmailAddresses(playerIds, currentUser);
            var playerDetailsViewModel = playerDetailsViewModelBuilder.Build(player, playerIdToRegisteredUserEmailAddressDictionary, fullUrl, currentUser);

            ViewBag.RecentGamesMessage = showingXResultsMessageBuilder.BuildMessage(
                NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                player.PlayerGameResults.Count);

            return(View(MVC.Player.Views.Details, playerDetailsViewModel));
        }
Beispiel #3
0
        public virtual ActionResult Details(int?id, ApplicationUser currentUser)
        {
            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            PlayerDetails player = playerRetriever.GetPlayerDetails(id.Value, NUMBER_OF_RECENT_GAMES_TO_RETRIEVE);

            if (player == null)
            {
                return(new HttpNotFoundResult());
            }

            var fullUrl = this.Url.Action(MVC.Player.ActionNames.Details, MVC.Player.Name, new { id }, this.Request.Url.Scheme) + "#minions";
            PlayerDetailsViewModel playerDetailsViewModel = playerDetailsViewModelBuilder.Build(player, fullUrl, currentUser);

            ViewBag.RecentGamesMessage = showingXResultsMessageBuilder.BuildMessage(
                NUMBER_OF_RECENT_GAMES_TO_RETRIEVE,
                player.PlayerGameResults.Count);

            return(View(MVC.Player.Views.Details, playerDetailsViewModel));
        }
Beispiel #4
0
        public void ItReturnsBlankIfTheActualNumberOfResultsIsLessThanTheMax()
        {
            string message = messageBuilder.BuildMessage(2, 1);

            Assert.AreEqual(string.Empty, message);
        }