public virtual ActionResult GetGamingGroupPlayers(int id, ApplicationUser currentUser, [System.Web.Http.FromUri]BasicDateRangeFilter dateRangeFilter = null)
        {
            var playersWithNemesis = playerRetriever.GetAllPlayersWithNemesisInfo(id, dateRangeFilter)
                .Select(player => playerWithNemesisViewModelBuilder.Build(player, currentUser))
                .ToList();

            ViewBag.canEdit = currentUser.CurrentGamingGroupId == id;

            return PartialView(MVC.Player.Views._PlayersPartial, playersWithNemesis);
        }
Esempio n. 2
0
        public virtual ActionResult GetGamingGroupPlayers(int id, ApplicationUser currentUser, [System.Web.Http.FromUri] BasicDateRangeFilter dateRangeFilter = null)
        {
            var playersWithNemesis = _playerRetriever.GetAllPlayersWithNemesisInfo(id, dateRangeFilter);
            var playerIds          = playersWithNemesis.Select(x => x.PlayerId).ToList();
            var playerIdToRegisteredUserEmailAddressDictionary =
                _playerRetriever.GetRegisteredUserEmailAddresses(playerIds, currentUser);

            var viewModels = ConstructPlwyerWithNemesisViewModels(currentUser, playersWithNemesis, playerIdToRegisteredUserEmailAddressDictionary);

            ViewBag.canEdit = currentUser.CurrentGamingGroupId == id;

            return(PartialView(MVC.Player.Views._PlayersPartial, viewModels));
        }
Esempio n. 3
0
        public GamingGroupSummary GetGamingGroupDetails(int gamingGroupId, int maxNumberOfGamesToRetrieve)
        {
            GamingGroup        gamingGroup = dataContext.FindById <GamingGroup>(gamingGroupId);
            GamingGroupSummary summary     = new GamingGroupSummary
            {
                Id                       = gamingGroup.Id,
                DateCreated              = gamingGroup.DateCreated,
                Name                     = gamingGroup.Name,
                OwningUserId             = gamingGroup.OwningUserId,
                PublicDescription        = gamingGroup.PublicDescription,
                PublicGamingGroupWebsite = gamingGroup.PublicGamingGroupWebsite
            };

            summary.PlayedGames = playedGameRetriever.GetRecentGames(maxNumberOfGamesToRetrieve, gamingGroupId);

            summary.Players = playerRetriever.GetAllPlayersWithNemesisInfo(gamingGroupId);

            summary.GameDefinitionSummaries = gameDefinitionRetriever.GetAllGameDefinitions(gamingGroupId);

            summary.OwningUser = dataContext.GetQueryable <ApplicationUser>().First(user => user.Id == gamingGroup.OwningUserId);

            return(summary);
        }
Esempio n. 4
0
        public GamingGroupSummary GetGamingGroupDetails(GamingGroupFilter filter)
        {
            var gamingGroup = dataContext.FindById <GamingGroup>(filter.GamingGroupId);
            var summary     = new GamingGroupSummary
            {
                Id                       = gamingGroup.Id,
                DateCreated              = gamingGroup.DateCreated,
                Name                     = gamingGroup.Name,
                OwningUserId             = gamingGroup.OwningUserId,
                PublicDescription        = gamingGroup.PublicDescription,
                PublicGamingGroupWebsite = gamingGroup.PublicGamingGroupWebsite
            };

            summary.PlayedGames = playedGameRetriever.GetRecentGames(filter.NumberOfRecentGamesToShow, filter.GamingGroupId, filter.DateRangeFilter);

            summary.Players = playerRetriever.GetAllPlayersWithNemesisInfo(filter.GamingGroupId, filter.DateRangeFilter);

            summary.GameDefinitionSummaries = gameDefinitionRetriever.GetAllGameDefinitions(filter.GamingGroupId, filter.DateRangeFilter);

            summary.OwningUser = dataContext.GetQueryable <ApplicationUser>().First(user => user.Id == gamingGroup.OwningUserId);

            return(summary);
        }