Exemple #1
0
        public async Task <IActionResult> Index()
        {
            var gameServerFilterModel = new GameServerFilterModel
            {
                Order = GameServerFilterModel.OrderBy.BannerServerListPosition
            }.ApplyAuthForServerAdmin(User);
            var servers = await _gameServersRepository.GetGameServers(gameServerFilterModel);

            var gameServerStatusFilterModel = new GameServerStatusFilterModel().ApplyAuthForGameServerStatus(User);
            var serversStatus = await _gameServerStatusRepository.GetAllStatusModels(gameServerStatusFilterModel, TimeSpan.Zero);

            var results = new List <ServersController.ServerInfoViewModel>();

            foreach (var server in servers)
            {
                var portalGameServerStatusDto = serversStatus.SingleOrDefault(ss => server.ServerId == ss.ServerId);

                if (portalGameServerStatusDto != null)
                {
                    results.Add(new ServersController.ServerInfoViewModel
                    {
                        GameServer       = server,
                        GameServerStatus = portalGameServerStatusDto
                    });
                }
            }

            return(View(results));
        }
        private async Task AddGameServersViewData(Guid?selected = null)
        {
            var filterModel = new GameServerFilterModel
            {
                Order = GameServerFilterModel.OrderBy.BannerServerListPosition
            }.ApplyAuthForBanFileMonitors(User);
            var gameServerDtos = await _gameServersRepository.GetGameServers(filterModel);

            ViewData["GameServers"] = new SelectList(gameServerDtos, "ServerId", "Title", selected);
        }
        public async Task <IActionResult> Index()
        {
            var filterModel = new GameServerFilterModel
            {
                Order = GameServerFilterModel.OrderBy.BannerServerListPosition
            }.ApplyAuthForGameServers(User);

            var gameServerDtos = await _gameServersRepository.GetGameServers(filterModel);

            return(View(gameServerDtos));
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var filterModel = new GameServerFilterModel
            {
                Order = GameServerFilterModel.OrderBy.BannerServerListPosition
            };

            var gameServerDtos = (await _gameServersRepository.GetGameServers(filterModel))
                                 .Where(s => s.ShowOnBannerServerList && !string.IsNullOrWhiteSpace(s.HtmlBanner))
                                 .ToList();

            return(View(gameServerDtos));
        }
        public async Task <IActionResult> ManageProfile(string id)
        {
            var user = await _usersRepository.GetUser(id);

            var filterModel = new GameServerFilterModel
            {
                Order = GameServerFilterModel.OrderBy.BannerServerListPosition
            }.ApplyAuthForUsers(User);
            var gameServers = await _gameServersRepository.GetGameServers(filterModel);

            ViewData["GameServers"]       = gameServers;
            ViewData["GameServersSelect"] = new SelectList(gameServers, "ServerId", "Title");

            return(View(user));
        }
        public async Task <IActionResult> GetGameServers()
        {
            var filterModel = new GameServerFilterModel
            {
                Order = GameServerFilterModel.OrderBy.BannerServerListPosition
            };

            var gameServerDtos = (await _gameServersRepository.GetGameServers(filterModel))
                                 .Where(s => s.ShowOnBannerServerList && !string.IsNullOrWhiteSpace(s.HtmlBanner))
                                 .ToList();

            var htmlBanners = gameServerDtos.Select(gs => gs.HtmlBanner).ToList();

            return(Json(htmlBanners));
        }