Exemplo n.º 1
0
        public async Task <PlayerListModel> MakeListModel(PlayerAdminSearchModel searchModel)
        {
            var players = await _playerAdminHandler.SearchPlayers(searchModel);

            var playerItems = players.Select(x => new PlayerListItemModel
            {
                AccountCreatedOnTimeStamp = x.AccountCreatedOnTimeStamp,
                AccountLevel       = x.AccountLevel,
                HoursPlayed        = x.HoursPlayed,
                LastLoginTimeStamp = x.LastLoginTimeStamp,
                MinutesPlayed      = x.MinutesPlayed,
                Name             = x.Name,
                PaladinsPlayerId = x.PaladinsPlayerId,
                TotalLeaves      = x.TotalLeaves,
                TotalWins        = x.TotalWins
            });
            var playerItemsPagedList = new PagedList <PlayerListItemModel>(
                playerItems,
                players.PageIndex,
                players.PageSize,
                players.TotalCount
                );

            return(new PlayerListModel().PrepareToGrid(searchModel, players, () => playerItemsPagedList));
        }
Exemplo n.º 2
0
 public async Task <IEnumerable <PlayerModel> > GetPlayers(PlayerAdminSearchModel request)
 {
     return(await Context.Player
            .ConditionalWhere(() => request.PlayerName.IsNotNull(), x => x.Name == request.PlayerName)
            .OrderByDescending(x => x.Id)
            .Select(x => _playerToModelMapper.Map(x))
            .ToListAsync());
 }
Exemplo n.º 3
0
 public async Task <IEnumerable <PlayerModel> > GetPlayerAsync(PlayerAdminSearchModel request)
 {
     return(await _unitOfWorkManager.ExecuteSingleAsync
            <IPlayerRepository, IEnumerable <PlayerModel> >
                (u => u.GetPlayers(request)));
 }
Exemplo n.º 4
0
        public async Task <JsonResult> Players(PlayerAdminSearchModel searchModel)
        {
            var model = await _playerModelFactory.MakeListModel(searchModel);

            return(Json(model));
        }