private static void AddOneSuperHero() { var SuperHero = new SuperHero() { Name = "FoxBear" }; using (var context = new SuperHeroContext()) { context.SuperHeroes.Add(SuperHero); context.SaveChanges(); } }
private static void AddSomeSuperHeros() { SuperHero[] superHeroes = { new SuperHero() { Name = "Superman" }, new SuperHero() { Name = "Batman" }, new SuperHero() { Name = "Wonderwoman" } }; using (var context = new SuperHeroContext()) { context.SuperHeroes.AddRange(superHeroes); context.SaveChanges(); } }
public GameLogic(SuperHeroContext dbcontext) { this.dbcontext = dbcontext; }
public HomeController(SuperHeroContext dbcontext) { logic = new GameLogic(dbcontext); }