public GamesForm(ChampionsContext db, int gameId) { this.db = db; this.gameId = gameId; InitializeComponent(); FillSourcesForEdit(); }
public ColorsForm(ChampionsContext db) { this.db = db; InitializeComponent(); btnRemove.Text = "\u2796"; btnNewColor.Text = "\u2795"; ListColors(); }
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(); }
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()); }
// 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); }
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()); }
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; }
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(); } }