Exemple #1
0
        public static void Initialize(MvcCharacterContext context)
        {
            context.Database.EnsureCreated();

            if (context.Character.Any())
            {
                return;
            }

            var characters = new Character[]
            {
                new Character {
                    Name = "Xingu", Atk = 15, Def = 12, Life = 26
                },
                new Character {
                    Name = "Aelien", Atk = 14, Def = 14, Life = 22
                },
                new Character {
                    Name = "Eveehi", Atk = 17, Def = 9, Life = 18
                }
            };

            foreach (Character c in characters)
            {
                context.Character.Add(c);
            }
            context.SaveChanges();

            var levels = new Level[]
            {
                new Level {
                    LevelID = 1, CharacterID = 1, Skills =
                }
            }

            var abilities = new Ability[]
            {
                new Ability {
                    LevelID = 1, CharacterID = 1, CharacterClass = CharacterClass.Thief
                },
                new Ability {
                    LevelID = 3, CharacterID = 2, CharacterClass = CharacterClass.Wizard
                },
                new Ability {
                    LevelID = 4, CharacterID = 3, CharacterClass = CharacterClass.Warrior
                },
            };

            foreach (Ability a in abilities)
            {
                context.Abilities.Add(a);
            }
            context.SaveChanges();
        }
 public DeleteModel(MvcCharacter.Data.MvcCharacterContext context)
 {
     _context = context;
 }
Exemple #3
0
 public EditModel(MvcCharacter.Data.MvcCharacterContext context)
 {
     _context = context;
 }
 public DetailsModel(MvcCharacter.Data.MvcCharacterContext context)
 {
     _context = context;
 }
 public IndexModel(MvcCharacter.Data.MvcCharacterContext context)
 {
     _context = context;
 }