Esempio n. 1
0
        public static void Initialize(QuestRoomContext context)
        {
            context.Database.EnsureCreated();

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

            var rooms = new Room[]
            {
                new Room()
                {
                    Address            = "Odessa",
                    Company            = "OdessaCompany",
                    Description        = "Odessa's room",
                    Email              = "*****@*****.**",
                    LevelOfDifficulty  = Difficulty.Normal,
                    LevelOfFear        = 1,
                    MinAmountOfPlayers = 1,
                    MaxAmountOfPlayers = 5,
                    MinAge             = 16,
                    Name          = "OdessaRoom",
                    PhoneNumber   = "380 88 888 88 88",
                    Rating        = 3.5f,
                    TimeOfPassing = 80
                },
                new Room()
                {
                    Address            = "Kyiv",
                    Company            = "KyivCompany",
                    Description        = "Kyiv's room",
                    Email              = "*****@*****.**",
                    LevelOfDifficulty  = Difficulty.Hard,
                    LevelOfFear        = 2,
                    MinAmountOfPlayers = 2,
                    MaxAmountOfPlayers = 7,
                    MinAge             = 18,
                    Name          = "KyivRoom",
                    PhoneNumber   = "380 88 888 88 87",
                    Rating        = 4.5f,
                    TimeOfPassing = 100
                }
            };

            foreach (var room in rooms)
            {
                context.Rooms.Add(room);
            }
            context.SaveChanges();
        }
        public static void Initialize(QuestRoomContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.Rooms.Any())
            {
                return;   // DB has been seeded
            }

            var rooms = new Room[]
            {
                new Room()
                {
                    Description        = "Lux quest with your friends",
                    LevelOfDifficulty  = Difficulty.Hard,
                    LevelOfFear        = 1,
                    MinAmountOfPlayers = 2,
                    MaxAmountOfPlayers = 8,
                    Name          = "Expert",
                    PhoneNumber   = "56 23 65 23",
                    Rating        = 2f,
                    TimeOfPassing = 23
                },
                new Room()
                {
                    Description        = "Great Idea for quest before wedding day",
                    LevelOfDifficulty  = Difficulty.Normal,
                    LevelOfFear        = 1,
                    MinAmountOfPlayers = 1,
                    MaxAmountOfPlayers = 5,
                    Name          = "Relax",
                    PhoneNumber   = "380 88 888 88 88",
                    Rating        = 3f,
                    TimeOfPassing = 120
                }
            };

            foreach (var room in rooms)
            {
                context.Rooms.Add(room);
            }
            context.SaveChanges();
        }