public GamesForm(ChampionsContext db, int gameId)
 {
     this.db     = db;
     this.gameId = gameId;
     InitializeComponent();
     FillSourcesForEdit();
 }
示例#2
0
 public ColorsForm(ChampionsContext db)
 {
     this.db = db;
     InitializeComponent();
     btnRemove.Text   = "\u2796";
     btnNewColor.Text = "\u2795";
     ListColors();
 }
示例#3
0
        public PlayersForm(ChampionsContext db)
        {
            this.db = db;
            InitializeComponent();
            ListPlayers();
            cboEditTeams.DataSource = cboNewTeams.DataSource = db.Teams.ToList();

            ListFilterTeams();
        }
 public TeamsForm(ChampionsContext db)
 {
     this.db = db;
     InitializeComponent();
     dgvTeams.AutoGenerateColumns = false;
     ListTeams();
     btnRemove.Text    = "\u2796";
     btnAddToTeam.Text = "\u2795";
 }
 public TeamColorsForm(/*ChampionsContext db,*/ int teamId)
 {
     //this.db = db;
     db = new ChampionsContext();
     this.selectedTeam = db.Teams.Find(teamId);
     InitializeComponent();
     btnRemove.Text   = "\u2796";
     btnNewColor.Text = "\u2795";
     lblTeamName.Text = selectedTeam.ShortName + " Colors";
     ListteamColors();
 }
示例#6
0
 public ActionResult Signup(RegisterModel model)
 {
     if (ModelState.IsValid)
     {
         using (var context = new ChampionsContext())
         {
             context.Participants.Add(model);
             context.SaveChanges();
             return(RedirectToAction("Welcome", model));
         }
     }
     return(View());
 }
示例#7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ChampionsContext champcontext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseMvc();
            DBInitializer.Initialize(champcontext);
        }
示例#8
0
 public ActionResult Login(Participant model)
 {
     if (ModelState.IsValid)
     {
         using (var context = new ChampionsContext())
         {
             var participant = context.Participants.FirstOrDefault(user => user.Login == model.Login);
             if (participant != null)
             {
                 return(RedirectToAction("Welcome", participant as Participant));
             }
         }
     }
     return(View());
 }
示例#9
0
 public ActionResult CreateTeam(Team model)
 {
     if (ModelState.IsValid)
     {
         Team team = null;
         using (ChampionsContext context = new ChampionsContext())
         {
             team = context.Teams.FirstOrDefault(club => club.Name == model.Name);
         }
         if (team == null)
         {
             using (ChampionsContext context = new ChampionsContext())
             {
                 context.Teams.Add(model);
                 context.SaveChanges();
                 return(RedirectToAction("Home", model));
             }
         }
     }
     return(View(model));
 }
 public ChampionController(ChampionsContext context)
 {
     this.context = context;
 }
 public GamesForm(ChampionsContext db)
 {
     this.db = db;
     InitializeComponent();
     FillSources();
 }
 public ChampionsRepository(ChampionsContext context)
 {
     this.context = context;
 }
示例#13
0
        public static void Initialize(ChampionsContext context)
        {
            context.Database.EnsureCreated();

            if (0 == context.Champions.Count())
            {
                context.Champions.Add(new Champion()
                {
                    Name = "Aatrox", Title = "The Darkin Blade", Attack = 8, Defense = 4, Magic = 3, Difficuly = 4, Role = Role.Fighter
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Ahri", Title = "The Nine-Tailed Fox", Attack = 3, Defense = 4, Magic = 8, Difficuly = 5, Role = Role.Mage
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Akali", Title = "The Fist of Shadow", Attack = 5, Defense = 3, Magic = 8, Difficuly = 7, Role = Role.Assassin
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Alistar", Title = "The Minotaur", Attack = 6, Defense = 9, Magic = 5, Difficuly = 7, Role = Role.Tank
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Amumu", Title = "The Sad Mummy", Attack = 2, Defense = 6, Magic = 8, Difficuly = 3, Role = Role.Jungler
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Anivia", Title = "The Cryophoenix", Attack = 1, Defense = 4, Magic = 10, Difficuly = 10, Role = Role.Mage
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Annie", Title = "The Dark Child", Attack = 2, Defense = 3, Magic = 10, Difficuly = 6, Role = Role.Mage
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Ashe", Title = "The Frost Archer", Attack = 7, Defense = 3, Magic = 2, Difficuly = 4, Role = Role.Marksman
                });
                context.Champions.Add(new Champion()
                {
                    Name = "AurelionSol", Title = "The Star Forger", Attack = 2, Defense = 3, Magic = 8, Difficuly = 7, Role = Role.Mage
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Azir", Title = "The Emperor of the sands", Attack = 6, Defense = 3, Magic = 8, Difficuly = 9, Role = Role.Mage
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Bard", Title = "The Wandering Caretaker", Attack = 4, Defense = 4, Magic = 5, Difficuly = 9, Role = Role.Support
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Blitzcrank", Title = "The Great Steam Golem", Attack = 4, Defense = 8, Magic = 5, Difficuly = 4, Role = Role.Support
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Brand", Title = "The Burning Vengeance", Attack = 2, Defense = 2, Magic = 9, Difficuly = 4, Role = Role.Mage
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Braum", Title = "The Heart of the Freljord", Attack = 3, Defense = 9, Magic = 4, Difficuly = 3, Role = Role.Support
                });
                context.Champions.Add(new Champion()
                {
                    Name = "Caitlyn", Title = "The Sheriff of Piltover", Attack = 8, Defense = 2, Magic = 2, Difficuly = 6, Role = Role.Marksman
                });
                context.SaveChanges();
            }
        }