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();
     }
 }
Example #3
0
 public GameLogic(SuperHeroContext dbcontext)
 {
     this.dbcontext = dbcontext;
 }
Example #4
0
 public HomeController(SuperHeroContext dbcontext)
 {
     logic = new GameLogic(dbcontext);
 }