예제 #1
0
        public static async Task AddTestData(HotelApiDbContext context)
        {
            if (context.Rooms.Any())
            {
                return;
            }
            context.Rooms.Add(new RoomEntity()
            {
                Id   = new Guid(),
                Name = "Oxford Suite",
                Rate = 1101
            });

            context.Rooms.Add(new RoomEntity()
            {
                Id   = new Guid(),
                Name = "Driscoll suite",
                Rate = 2345
            });

            await context.SaveChangesAsync();
        }
예제 #2
0
        public static async Task addTestData(HotelApiDbContext context)
        {
            if (context.Rooms.Any())
            {
                //already has data;
                return;
            }

            context.Rooms.Add(new RoomEntity
            {
                Id   = Guid.Parse("E9089998-ACA7-4123-94DE-5FEFDC0C9837"),
                Name = "King Suite",
                Rate = 1020
            });
            context.Rooms.Add(new RoomEntity
            {
                Id   = Guid.Parse("105D31B8-3D4E-4C03-8B06-5FD8C960F445"),
                Name = "Queen Suite",
                Rate = 2111
            });

            await context.SaveChangesAsync();
        }
예제 #3
0
        public static async Task AddTestData(HotelApiDbContext context)
        {
            if (context.Rooms.Any())
            {
                // Already has data
                return;
            }

            context.Rooms.Add(new RoomEntity
            {
                Id   = Guid.Parse("301df04d-8679-4b1b-ab92-0a586ae53d08"),
                Name = "Oxford Suite",
                Rate = 10119,
            });

            context.Rooms.Add(new RoomEntity
            {
                Id   = Guid.Parse("ee2b83be-91db-4de5-8122-35a9e9195976"),
                Name = "Driscoll Suite",
                Rate = 23959
            });

            await context.SaveChangesAsync();
        }