public IActionResult CreateTournament()
 {
     ViewBag.Stadiums    = new SelectList(_stadiumService.GetAll(), "Id", "Name");
     ViewBag.GameServers = new SelectList(_gameServerService.GetAll(), "Id", "ServerName");
     ViewBag.CetTime     = StaticVars.CET_TIME;
     return(View(new CreateTournamentDto()));
 }
示例#2
0
        public async Task <ActionResult> Index()
        {
            var list = await _stadionService.GetAll();

            List <StadiumVM> listVM = _mapper.Map <List <StadiumVM> >(list);

            return(View(listVM));
        }
示例#3
0
        public IActionResult Index()
        {
            var stadiums          = stadiumService.GetAll();
            var stadiumViewModels = stadiums.Select(s => new StadiumViewModel
            {
                Id          = s.Id,
                Name        = s.Name,
                FoundedOn   = s.FoundedOn,
                Capacity    = s.Capacity,
                CountryId   = s.Country.Id,
                CountryName = s.Country.Name
            });

            return(View(stadiumViewModels));
        }
        public IActionResult All()
        {
            var stadiums = stadiumService.GetAll();

            return(View(stadiums));
        }
        public static void SeedData(IGameServerService _gameServerService, IStadiumService _stadiumService, UserManager <AppUser> _userManager, RoleManager <AppRole> _roleManager)
        {
            var gameServers = _gameServerService.GetAll();

            if (gameServers.Count <= 0)
            {
                _gameServerService.Add(new GameServerEntity {
                    ServerName = "EU Dedicated"
                });
                _gameServerService.Add(new GameServerEntity {
                    ServerName = "USA Dedicated"
                });
                _gameServerService.Add(new GameServerEntity {
                    ServerName = "Hosted Server"
                });
            }

            var stadiums = _stadiumService.GetAll();

            if (stadiums.Count <= 0)
            {
                _stadiumService.Add(new StadiumEntity {
                    Name = "Real Football"
                });
                _stadiumService.Add(new StadiumEntity {
                    Name = "Good"
                });
                _stadiumService.Add(new StadiumEntity {
                    Name = "Classic"
                });
                _stadiumService.Add(new StadiumEntity {
                    Name = "Small"
                });
                _stadiumService.Add(new StadiumEntity {
                    Name = "Real Football"
                });
                _stadiumService.Add(new StadiumEntity {
                    Name = "Small Pong"
                });
            }


            var roles = _roleManager.Roles.ToList();

            if (roles.Count <= 0)
            {
                _roleManager.CreateAsync(new AppRole {
                    Name = ConstRoles.Admin
                }).Wait();
                _roleManager.CreateAsync(new AppRole {
                    Name = ConstRoles.Member
                }).Wait();
            }


            var adminUser = _userManager.FindByNameAsync("compo").Result;

            if (adminUser == null)
            {
                AppUser user = new AppUser
                {
                    Email    = "*****@*****.**",
                    Login    = "******",
                    UserName = "******"
                };
                string pass = "******";
                _userManager.CreateAsync(user, pass).Wait();
                _userManager.AddToRoleAsync(user, ConstRoles.Admin).Wait();
            }
        }