Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("RoomBandID,BandDesc")] RoomBand roomBand)
        {
            if (id != roomBand.RoomBandID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(roomBand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomBandExists(roomBand.RoomBandID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(roomBand));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("RoomBandID,BandDesc")] RoomBand roomBand)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roomBand);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(roomBand));
        }
Exemple #3
0
        public static void Initialize(HotelContext context)
        {
            context.Database.EnsureCreated();

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

            //Customers
            var customers = new Customer[]
            {
                new Customer {
                    CustomerTitle         = "Ing.", CustomerForenames = "Alejandro", CustomerSurnames = "Garcia Cortes",
                    CustomerDOB           = DateTime.Parse("1995-03-11"), CustomerAddressStreet = "Monterrey 24", CustomerAddressTown = "Zacatecas",
                    CustomerAddressCounty = "Guadalupe", CustomerAddressPostalCode = "98615", CustomerHomePhone = "492 926 5614",
                    CustomerWorkPhone     = null, CustomerMobilePhone = "492 650 8190", CustomerEmail = "*****@*****.**"
                },
                new Customer {
                    CustomerTitle         = "Lic.", CustomerForenames = "Diana", CustomerSurnames = "Escareño Luna",
                    CustomerDOB           = DateTime.Parse("1993-11-20"), CustomerAddressStreet = "Fuentes 51", CustomerAddressTown = "Aguascalientes",
                    CustomerAddressCounty = "Aguascalientes", CustomerAddressPostalCode = "97995", CustomerHomePhone = "449 443 8096",
                    CustomerWorkPhone     = "449 162 9831", CustomerMobilePhone = "449 210 8716", CustomerEmail = "*****@*****.**"
                },
                new Customer {
                    CustomerTitle         = "Ing.", CustomerForenames = "Carlos", CustomerSurnames = "Gonzalez Beltran",
                    CustomerDOB           = DateTime.Parse("1980-01-10"), CustomerAddressStreet = "Gardenias 14", CustomerAddressTown = "Zacatecas",
                    CustomerAddressCounty = "Fresnillo", CustomerAddressPostalCode = "96005", CustomerHomePhone = "493 102 6176",
                    CustomerWorkPhone     = null, CustomerMobilePhone = "493 110 7685", CustomerEmail = "*****@*****.**"
                },
                new Customer {
                    CustomerTitle         = "Dr.", CustomerForenames = "Celina", CustomerSurnames = "Reyes Delgado",
                    CustomerDOB           = DateTime.Parse("1987-08-12"), CustomerAddressStreet = "12Octubre 56", CustomerAddressTown = "Zacatecas",
                    CustomerAddressCounty = "Guadalupe", CustomerAddressPostalCode = "98618", CustomerHomePhone = "492 187 7726",
                    CustomerWorkPhone     = "492 901 7165", CustomerMobilePhone = "492 173 7862", CustomerEmail = null
                }
            };

            foreach (Customer ia in customers)
            {
                context.Customers.Add(ia);
            }
            context.SaveChanges();

            //Guest
            var guests = new Guest[]
            {
                new Guest {
                    GuestTitle         = "Ing.", GuestForenames = "Alejandro", GuestSurnames = "Garcia Cortes", GuestDOB = DateTime.Parse("1995-03-11"),
                    GuestAddressStreet = "Monterrey 24", GuestAddressTown = "Zacatecas", GuestAddressCounty = "Guadalupe", GuestAddressPostalCode = "98615",
                    GuestContactPhone  = "492 650 8190"
                },
                new Guest {
                    GuestTitle         = "Sra.", GuestForenames = "Martha", GuestSurnames = "Escareño Perez", GuestDOB = DateTime.Parse("1991-06-01"),
                    GuestAddressStreet = "Gonzales Ortega 113", GuestAddressTown = "Zacatecas", GuestAddressCounty = "Guadalupe", GuestAddressPostalCode = "98256",
                    GuestContactPhone  = "492 662 5410"
                },
                new Guest {
                    GuestTitle         = "Sr.", GuestForenames = "Ernesto", GuestSurnames = "Baez Beltran", GuestDOB = DateTime.Parse("1979-12-28"),
                    GuestAddressStreet = "Condesa 23", GuestAddressTown = "Zacatecas", GuestAddressCounty = "Fresnillo", GuestAddressPostalCode = "96700",
                    GuestContactPhone  = "493 675 1273"
                },
                new Guest {
                    GuestTitle         = "Dr.", GuestForenames = "Celina", GuestSurnames = "Reyes Delgado", GuestDOB = DateTime.Parse("1987-08-12"),
                    GuestAddressStreet = "12Octubre 56", GuestAddressTown = "Zacatecas", GuestAddressCounty = "Guadalupe", GuestAddressPostalCode = "98618",
                    GuestContactPhone  = "492 173 7862"
                }
            };

            foreach (Guest ib in guests)
            {
                context.Guests.Add(ib);
            }
            context.SaveChanges();

            //Booking
            var bookings = new Booking[]
            {
                new Booking {
                    DateBookingMade       = DateTime.Parse("2019-10-01"), TimeBookingMade = DateTime.Parse("11:02:13"),
                    BookedStartDate       = DateTime.Parse("2019-10-11"), BookedEndDate = DateTime.Parse("2019-10-21"), TotalPaymentDueDate = DateTime.Parse("2019-11-11"),
                    TotalPaymentDueAmount = 300, TotalPaymentMadeOn = DateTime.Parse("2019-10-30"), BookingComments = null,
                    CustomerID            = customers.Single(c => c.CustomerForenames == "Alejandro").CustomerID
                },
                new Booking {
                    DateBookingMade       = DateTime.Parse("2019-12-22"), TimeBookingMade = DateTime.Parse("09:12:43"),
                    BookedStartDate       = DateTime.Parse("2019-12-25"), BookedEndDate = DateTime.Parse("2020-01-07"), TotalPaymentDueDate = DateTime.Parse("2020-01-25"),
                    TotalPaymentDueAmount = 0, TotalPaymentMadeOn = DateTime.Parse("2019-12-22"), BookingComments = "La reservacion se pago el dia que fue realizada",
                    CustomerID            = customers.Single(c => c.CustomerForenames == "Diana").CustomerID
                },
                new Booking {
                    DateBookingMade       = DateTime.Parse("2020-02-14"), TimeBookingMade = DateTime.Parse("08:32:13"),
                    BookedStartDate       = DateTime.Parse("2020-03-03"), BookedEndDate = DateTime.Parse("2020-03-15"), TotalPaymentDueDate = DateTime.Parse("2020-04-03"),
                    TotalPaymentDueAmount = 700, TotalPaymentMadeOn = DateTime.Parse("2020-03-03"), BookingComments = "La reservacion se pago el dia que finalizo",
                    CustomerID            = customers.Single(c => c.CustomerForenames == "Carlos").CustomerID
                },
                new Booking {
                    DateBookingMade       = DateTime.Parse("2020-04-23"), TimeBookingMade = DateTime.Parse("12:47:53"),
                    BookedStartDate       = DateTime.Parse("2020-04-30"), BookedEndDate = DateTime.Parse("2020-05-08"), TotalPaymentDueDate = DateTime.Parse("2020-05-30"),
                    TotalPaymentDueAmount = 500, TotalPaymentMadeOn = DateTime.Parse("2020-05-13"), BookingComments = null,
                    CustomerID            = customers.Single(c => c.CustomerForenames == "Celina").CustomerID
                }
            };

            foreach (Booking ic in bookings)
            {
                context.Bookings.Add(ic);
            }
            context.SaveChanges();

            //RoomType
            var roomtypes = new RoomType[]
            {
                new RoomType {
                    roomType = roomType.Individual
                },
                new RoomType {
                    roomType = roomType.Doble
                },
                new RoomType {
                    roomType = roomType.Cuadruple
                },
                new RoomType {
                    roomType = roomType.JuniorSuite
                },
                new RoomType {
                    roomType = roomType.Suite
                },
                new RoomType {
                    roomType = roomType.GranSuite
                }
            };

            foreach (RoomType id in roomtypes)
            {
                context.RoomTypes.Add(id);
            }
            context.SaveChanges();

            //RoomBand
            var roombands = new RoomBand[]
            {
                new RoomBand {
                    BandDesc = "A"
                },
                new RoomBand {
                    BandDesc = "AA"
                },
                new RoomBand {
                    BandDesc = "AAA"
                },
                new RoomBand {
                    BandDesc = "AAAA"
                },
                new RoomBand {
                    BandDesc = "AAAAA"
                }
            };

            foreach (RoomBand ie in roombands)
            {
                context.RoomBands.Add(ie);
            }
            context.SaveChanges();

            //RoomPrice
            var roomprices = new RoomPrice[]
            {
                new RoomPrice {
                    roomPrice = 500
                },
                new RoomPrice {
                    roomPrice = 1000
                },
                new RoomPrice {
                    roomPrice = 1800
                },
                new RoomPrice {
                    roomPrice = 2000
                },
                new RoomPrice {
                    roomPrice = 2400
                }
            };

            foreach (RoomPrice ig in roomprices)
            {
                context.RoomPrices.Add(ig);
            }
            context.SaveChanges();

            //Room
            var rooms = new Room[]
            {
                new Room {
                    Floor       = "2", AdditionalNotes = "Habitacion: Individual - Precio: $500 por dia",
                    RoomTypeID  = roomtypes.Single(c => c.roomType == roomType.Individual).RoomTypeID,
                    RoomBandID  = roombands.Single(i => i.BandDesc == "A").RoomBandID,
                    RoomPriceID = roomprices.Single(s => s.roomPrice == 500).RoomPriceID
                },
                new Room {
                    Floor       = "3", AdditionalNotes = "Habitacion: Doble - Precio: $1000 por dia",
                    RoomTypeID  = roomtypes.Single(c => c.roomType == roomType.Doble).RoomTypeID,
                    RoomBandID  = roombands.Single(i => i.BandDesc == "AA").RoomBandID,
                    RoomPriceID = roomprices.Single(s => s.roomPrice == 1000).RoomPriceID
                },
                new Room {
                    Floor       = "4", AdditionalNotes = "Habitacion: Cuadruple - Precio: $1800 por dia",
                    RoomTypeID  = roomtypes.Single(c => c.roomType == roomType.Cuadruple).RoomTypeID,
                    RoomBandID  = roombands.Single(i => i.BandDesc == "AAAA").RoomBandID,
                    RoomPriceID = roomprices.Single(s => s.roomPrice == 1800).RoomPriceID
                },
                new Room {
                    Floor       = "6", AdditionalNotes = "Habitacion: Suite - Precio: $2400 por dia",
                    RoomTypeID  = roomtypes.Single(c => c.roomType == roomType.Suite).RoomTypeID,
                    RoomBandID  = roombands.Single(i => i.BandDesc == "AAAAA").RoomBandID,
                    RoomPriceID = roomprices.Single(s => s.roomPrice == 2400).RoomPriceID
                }
            };

            foreach (Room ih in rooms)
            {
                context.Rooms.Add(ih);
            }
            context.SaveChanges();

            //BookingRoom
            var bookingsrooms = new BookingRoom[]
            {
                new BookingRoom {
                    BookingID = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2019-10-01")).BookingID,
                    RoomID    = rooms.Single(i => i.Floor == "2").RoomID,
                    GuestID   = guests.Single(s => s.GuestForenames == "Alejandro").GuestID
                },
                new BookingRoom {
                    BookingID = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2019-12-22")).BookingID,
                    RoomID    = rooms.Single(i => i.Floor == "3").RoomID,
                    GuestID   = guests.Single(s => s.GuestForenames == "Martha").GuestID
                },
                new BookingRoom {
                    BookingID = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2020-02-14")).BookingID,
                    RoomID    = rooms.Single(i => i.Floor == "4").RoomID,
                    GuestID   = guests.Single(s => s.GuestForenames == "Ernesto").GuestID
                },
                new BookingRoom {
                    BookingID = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2020-04-23")).BookingID,
                    RoomID    = rooms.Single(i => i.Floor == "6").RoomID,
                    GuestID   = guests.Single(s => s.GuestForenames == "Celina").GuestID
                }
            };

            foreach (BookingRoom i in bookingsrooms)
            {
                context.BookingsRooms.Add(i);
            }
            context.SaveChanges();

            foreach (BookingRoom ix in bookingsrooms)
            {
                var bookingroomInDataBase = context.BookingsRooms.Where(
                    z =>
                    z.Booking.BookingID == ix.BookingID &&
                    z.Room.RoomID == ix.RoomID &&
                    z.Guest.GuestID == ix.GuestID).SingleOrDefault();
                if (bookingroomInDataBase == null)
                {
                    context.BookingsRooms.Add(ix);
                }
            }
            context.SaveChanges();

            //PaymentMethod
            var paymentmethods = new PaymentMethod[]
            {
                new PaymentMethod {
                    paymentMethod = "Efectivo"
                },
                new PaymentMethod {
                    paymentMethod = "Tarjeta de Credito o Debito"
                },
                new PaymentMethod {
                    paymentMethod = "Transferencia Bancaria"
                },
                new PaymentMethod {
                    paymentMethod = "Paypal"
                }
            };

            foreach (PaymentMethod ip in paymentmethods)
            {
                context.PaymentMethods.Add(ip);
            }
            context.SaveChanges();

            //Payment
            var payments = new Payment[]
            {
                new Payment {
                    PaymentAmount   = 6000, PaymentComments = "Pago saldado totalmente",
                    BookingID       = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2019-10-01")).BookingID,
                    CustomerID      = customers.Single(i => i.CustomerForenames == "Alejandro").CustomerID,
                    PaymentMethodID = paymentmethods.Single(s => s.paymentMethod == "Efectivo").PaymentMethodID
                },
                new Payment {
                    PaymentAmount   = 5000, PaymentComments = "Pago saldado totalmente",
                    BookingID       = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2019-12-22")).BookingID,
                    CustomerID      = customers.Single(i => i.CustomerForenames == "Diana").CustomerID,
                    PaymentMethodID = paymentmethods.Single(s => s.paymentMethod == "Transferencia Bancaria").PaymentMethodID
                },
                new Payment {
                    PaymentAmount   = 10000, PaymentComments = "Pago saldado parcialmente",
                    BookingID       = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2020-02-14")).BookingID,
                    CustomerID      = customers.Single(i => i.CustomerForenames == "Carlos").CustomerID,
                    PaymentMethodID = paymentmethods.Single(s => s.paymentMethod == "Efectivo").PaymentMethodID
                },
                new Payment {
                    PaymentAmount   = 6000, PaymentComments = "Pago saldado totalmente",
                    BookingID       = bookings.Single(c => c.DateBookingMade == DateTime.Parse("2020-04-23")).BookingID,
                    CustomerID      = customers.Single(i => i.CustomerForenames == "Celina").CustomerID,
                    PaymentMethodID = paymentmethods.Single(s => s.paymentMethod == "Paypal").PaymentMethodID
                }
            };

            foreach (Payment iq in payments)
            {
                context.Payments.Add(iq);
            }
            context.SaveChanges();

            //FacilitieList
            var facilitielists = new FacilitieList[]
            {
                new FacilitieList {
                    FacilityDesc = "(1)Cama individual - (1)TV - Telefono - Refrigerador - Microondas - Internet - Cafetera - Otros muebles"
                },
                new FacilitieList {
                    FacilityDesc = "(2)Cama individual - (1)TV - Telefono - Refrigerador - Microondas - Internet - Cafetera - Plancha - Otros muebles"
                },
                new FacilitieList {
                    FacilityDesc = "(4)Cama individual - (2)TV - Telefono - Refrigerador - Microondas - Internet - Cafetera - Plancha - Otros muebles"
                },
                new FacilitieList {
                    FacilityDesc = "(2)Cama matrimonial - (2)TV - Telefono - (1)Computadora - Refrigerador - Microondas - Internet - Cafetera - Plancha - Jacuzzi - Otros muebles"
                },
                new FacilitieList {
                    FacilityDesc = "(2)Cama matrimonial - (1)TV - Telefono - (1)Computadora- Refrigerador - Microondas - Internet - Cafetera - Plancha - Otros muebles"
                },
                new FacilitieList {
                    FacilityDesc = "(2)Cama king-size - (2)TV - Telefono - (2)Computadora - Refrigerador - Microondas - Internet - Cafetera - Plancha,  Jacuzzi - Alberca - Otros muebles"
                }
            };

            foreach (FacilitieList io in facilitielists)
            {
                context.FacilitieLists.Add(io);
            }
            context.SaveChanges();

            //RoomFacilities
            var roomsfacilities = new RoomFacilities[]
            {
                new RoomFacilities {
                    FacilityDetails = "Incluye servicios basicos",
                    RoomID          = rooms.Single(c => c.Floor == "2").RoomID,
                    FacilityID      = facilitielists.Single(s => s.FacilityDesc == "(1)Cama individual - (1)TV - Telefono - Refrigerador - Microondas - Internet - Cafetera - Otros muebles").FacilityID,
                },
                new RoomFacilities {
                    FacilityDetails = "Incluye servicios basicos",
                    RoomID          = rooms.Single(c => c.Floor == "3").RoomID,
                    FacilityID      = facilitielists.Single(s => s.FacilityDesc == "(2)Cama individual - (1)TV - Telefono - Refrigerador - Microondas - Internet - Cafetera - Plancha - Otros muebles").FacilityID,
                },
                new RoomFacilities {
                    FacilityDetails = "Incluye servicios basicos + extra",
                    RoomID          = rooms.Single(c => c.Floor == "4").RoomID,
                    FacilityID      = facilitielists.Single(s => s.FacilityDesc == "(4)Cama individual - (2)TV - Telefono - Refrigerador - Microondas - Internet - Cafetera - Plancha - Otros muebles").FacilityID,
                },
                new RoomFacilities {
                    FacilityDetails = "Incluye servicios basicos + extra",
                    RoomID          = rooms.Single(c => c.Floor == "6").RoomID,
                    FacilityID      = facilitielists.Single(s => s.FacilityDesc == "(2)Cama matrimonial - (2)TV - Telefono - (1)Computadora - Refrigerador - Microondas - Internet - Cafetera - Plancha - Jacuzzi - Otros muebles").FacilityID
                }
            };

            foreach (RoomFacilities im in roomsfacilities)
            {
                context.RoomsFacilities.Add(im);
            }
            context.SaveChanges();

            foreach (RoomFacilities ir in roomsfacilities)
            {
                var roomfacilitiesInDataBase = context.RoomsFacilities.Where(
                    w =>
                    w.Room.RoomID == ir.RoomID &&
                    w.FacilitieList.FacilityID == ir.FacilityID).SingleOrDefault();
                if (roomfacilitiesInDataBase == null)
                {
                    context.RoomsFacilities.Add(ir);
                }
            }
            context.SaveChanges();
        }
Exemple #4
0
        public static void Initializate(HotelContext context)
        {
            context.Database.EnsureCreated();
            if (context.FacilitieLists.Any())
            {
                return; //la base de dats ya tiene datos
            }

            var FacilitieList = new FacilitieList[] {
                new FacilitieList {
                    FacilityID = 1, FacilityDesc = "facilitr1"
                },
                new FacilitieList {
                    FacilityID = 2, FacilityDesc = "facilitr2"
                },
                new FacilitieList {
                    FacilityID = 3, FacilityDesc = "facilitr3"
                }
            };

            foreach (FacilitieList q in FacilitieList)
            {
                context.FacilitieLists.Add(q);
            }
            context.SaveChanges();
            //Guest
            var Guest = new Guest[] {
                new Guest {
                    GuestID = 1, GuestTitle = "1", GuestForenames = "Carlos", GuestSurnames = "Lopez", GuestDOB = DateTime.Parse("1/1/2018"), GuestAddressCountry = "México", GuestAddressTown = "Zacatecas", GuestAddressStreet = "Insurgentes", GuestAddressPostaleCode = "98000", GuestContactPhone = "4987563651"
                },
                new Guest {
                    GuestID = 2, GuestTitle = "2", GuestForenames = "Manuel", GuestSurnames = "Hernandez", GuestDOB = DateTime.Parse("2/2/2018"), GuestAddressCountry = "México", GuestAddressTown = "Zacatecas", GuestAddressStreet = "Morelos", GuestAddressPostaleCode = "98000", GuestContactPhone = "4596878963"
                },
                new Guest {
                    GuestID = 3, GuestTitle = "3", GuestForenames = "Maria", GuestSurnames = "Benitez", GuestDOB = DateTime.Parse("2/2/2018"), GuestAddressCountry = "México", GuestAddressTown = "Jalisco", GuestAddressStreet = "Hacienda nueva", GuestAddressPostaleCode = "96000", GuestContactPhone = "4469878963"
                }
            };

            foreach (Guest u in Guest)
            {
                context.Guests.Add(u);
            }
            context.SaveChanges();
            //Customer
            var Customer = new Customer[] {
                new Customer {
                    CustomerID             = 1, CustomerTitle = "1", CustomerForenames = "Guadalupe", CustomerSurnames = "Gonzalez", CustomerDOB = DateTime.Parse("1/1/2019"),
                    CustomerAddressCountry = "España", CustomerAddressTown = "España", CustomerAddressStreet = "España", CustomerAddressPostalCode = "1236", CustomerCustomEmail = "*****@*****.**", CustomerHomePhone = "6987453210"
                },
                new Customer {
                    CustomerID             = 2, CustomerTitle = "2", CustomerForenames = "Alejandro", CustomerSurnames = "Betancourth", CustomerDOB = DateTime.Parse("2/2/2019"),
                    CustomerAddressCountry = "USA", CustomerAddressTown = "Los Angeles", CustomerAddressStreet = "California", CustomerAddressPostalCode = "9874", CustomerCustomEmail = "*****@*****.**", CustomerHomePhone = "3698741225"
                },
                new Customer {
                    CustomerID             = 3, CustomerTitle = "3", CustomerForenames = "Alicia", CustomerSurnames = "Jara", CustomerDOB = DateTime.Parse("3/3/2019"),
                    CustomerAddressCountry = "Mexico", CustomerAddressTown = "Zacatecas", CustomerAddressStreet = "Zacatecas", CustomerAddressPostalCode = "98000", CustomerCustomEmail = "*****@*****.**", CustomerHomePhone = "4589632123"
                }
            };

            foreach (Customer i in Customer)
            {
                context.Customers.Add(i);
            }
            context.SaveChanges();


            //Roomtypes
            var RoomType = new RoomType[] {
                new RoomType {
                    RoomTypeID = 1, RoomTypes = "Individual"
                },
                new RoomType {
                    RoomTypeID = 2, RoomTypes = "Compartido"
                },
                new RoomType {
                    RoomTypeID = 3, RoomTypes = "Matrimonial"
                }
            };

            foreach (RoomType e in RoomType)
            {
                context.RoomTypes.Add(e);
            }
            context.SaveChanges();

            //RoomBand
            var RoomBand = new RoomBand[] {
                new RoomBand {
                    RoomBandID = 1, BandDesc = "Band1"
                },
                new RoomBand {
                    RoomBandID = 2, BandDesc = "Band2"
                },
                new RoomBand {
                    RoomBandID = 3, BandDesc = "Band3"
                }
            };

            foreach (RoomBand r in RoomBand)
            {
                context.RoomBands.Add(r);
            }
            context.SaveChanges();

            //RoomPrice
            var RoomPrice = new RoomPrice[] {
                new RoomPrice {
                    RoomPriceID = 1, RoomPrices = 1000
                },
                new RoomPrice {
                    RoomPriceID = 2, RoomPrices = 1500
                },
                new RoomPrice {
                    RoomPriceID = 3, RoomPrices = 2000
                }
            };

            foreach (RoomPrice t in RoomPrice)
            {
                context.RoomPrices.Add(t);
            }
            context.SaveChanges();

            //Room
            var Room = new Room[] {
                new Room {
                    RoomID = 1, RoomTypeID = 1, RoomBandID = 1, RoomPriceID = 1, Floor = "1"
                },
                new Room {
                    RoomID = 2, RoomTypeID = 2, RoomBandID = 2, RoomPriceID = 2, Floor = "2"
                },
                new Room {
                    RoomID = 3, RoomTypeID = 3, RoomBandID = 3, RoomPriceID = 3, Floor = "3"
                }
            };

            foreach (Room y in Room)
            {
                context.Rooms.Add(y);
            }
            context.SaveChanges();

            //RoomFacilitieList
            var RoomFacilitieList = new RoomFacilitieList[] {
                new RoomFacilitieList {
                    FacilityID = 1, RoomID = 1, FacilityDetails = "Instalacion grifo"
                },
                new RoomFacilitieList {
                    FacilityID = 2, RoomID = 2, FacilityDetails = "Regadera"
                },
                new RoomFacilitieList {
                    FacilityID = 3, RoomID = 3, FacilityDetails = "Cama"
                }
            };

            foreach (RoomFacilitieList w in RoomFacilitieList)
            {
                context.RoomFacilitieLists.Add(w);
            }
            context.SaveChanges();

            //PaymentMethod
            var PaymentMethod = new PaymentMethod[] {
                new PaymentMethod {
                    PaymentMethodID = 1, PaymentMethods = "Paypal"
                },
                new PaymentMethod {
                    PaymentMethodID = 2, PaymentMethods = "Cheque"
                },
                new PaymentMethod {
                    PaymentMethodID = 3, PaymentMethods = "Efectivo"
                }
            };

            foreach (PaymentMethod o in PaymentMethod)
            {
                context.PaymentMethods.Add(o);
            }
            context.SaveChanges();

            //Booking
            var Booking = new Booking[] {
                new Booking {
                    BookingID     = 1, CustomerID = 1, DateBookingMade = DateTime.Parse("1/1/2019"), TimeBookingMade = "dos dias", BookedStartDate = DateTime.Parse("29/2/2019"),
                    BookedEndDate = DateTime.Parse("8/2/2019"), TotalPaymentDueAmount = 200, TotalPaymentDueDate = DateTime.Parse("1/3/2019"), BookingComments = "Sin comentarios"
                },
                new Booking {
                    BookingID     = 2, CustomerID = 2, DateBookingMade = DateTime.Parse("2/2/2019"), TimeBookingMade = "dos dias", BookedStartDate = DateTime.Parse("4/2/2019"),
                    BookedEndDate = DateTime.Parse("12/3/2019"), TotalPaymentDueAmount = 400, TotalPaymentDueDate = DateTime.Parse("11/12/2019"), BookingComments = "Sin comentarios"
                },
                new Booking {
                    BookingID     = 3, CustomerID = 3, DateBookingMade = DateTime.Parse("2/3/2019"), TimeBookingMade = "tres dias", BookedStartDate = DateTime.Parse("5/2/2019"),
                    BookedEndDate = DateTime.Parse("10/11/2019"), TotalPaymentDueAmount = 600, TotalPaymentDueDate = DateTime.Parse("4/10/2019"), BookingComments = "Sin comentarios"
                }
            };

            foreach (Booking p in Booking)
            {
                context.Bookings.Add(p);
            }
            context.SaveChanges();

            //Payment
            var Payment = new Payment[] {
                new Payment {
                    PaymentID = 1, BookingID = 1, CustomerID = 1, PaymentMethodID = 1, PaymentAmount = 200, PaymentComments = "Sin comentario"
                },
                new Payment {
                    PaymentID = 2, BookingID = 2, CustomerID = 2, PaymentMethodID = 2, PaymentAmount = 300, PaymentComments = "Sin comentario"
                },
                new Payment {
                    PaymentID = 3, BookingID = 3, CustomerID = 3, PaymentMethodID = 3, PaymentAmount = 200, PaymentComments = "Sin comentario"
                }
            };

            foreach (Payment a in Payment)
            {
                context.Payments.Add(a);
            }
            context.SaveChanges();

            //Bookings Room
            var BookingRoom = new BookingRoom [] {
                new BookingRoom {
                    BookingID = 1, RoomID = 1, GuestID = 1
                },
                new BookingRoom {
                    BookingID = 2, RoomID = 2, GuestID = 2
                },
                new BookingRoom {
                    BookingID = 3, RoomID = 3, GuestID = 3
                }
            };

            foreach (BookingRoom s in BookingRoom)
            {
                context.BookingRooms.Add(s);
            }
            context.SaveChanges();
        }
        public static void Initialize(Context context)
        {
            context.Database.EnsureCreated();

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

// Customers
            var customers = new Customer[]
            {
                new Customer {
                    CustomerID                = 100,
                    CustomerTitle             = "Standard",
                    CustomerForenames         = "Hernandez",
                    CustomerSurnames          = "Pedro",
                    CustomerDOB               = DateTime.Parse("1992-09-01"),
                    CustomerAddressStreet     = "Calle 1",
                    CustomerAddressTown       = "Zacatecas",
                    CustomerAddressCountry    = "Mexico",
                    CustomerAddressPostalCode = "98000",
                    CustomerHomePhone         = "4928896558",
                    CustomerWorkPhone         = "4927796251",
                    CustomerMobilPhone        = "4988898521",
                    CustomerEmail             = "*****@*****.**"
                }
            };

            foreach (Customer s in customers)
            {
                context.Customers.Add(s);
            }
            context.SaveChanges();
// Booking *

            var bookings = new Booking[]
            {
                new Booking {
                    BookingID             = 10,
                    CustomerID            = customers.Single(c => c.CustomerSurnames == "Pedro").CustomerID,
                    DateBookingMade       = DateTime.Parse("2020-09-01"),
                    TimeBookingMade       = DateTime.Parse("2020-09-01"),
                    BookedStartDate       = DateTime.Parse("2020-09-02"),
                    BookedEndDate         = DateTime.Parse("2020-09-06"),
                    TotalPaymentDueDate   = DateTime.Parse("2020-09-06"),
                    TotalPaymentDueAmount = 2500,
                    TotalPaymentMadeOn    = DateTime.Parse("2020-09-06"),
                    BookingComments       = "Reservación correcta"
                }
            };

            foreach (Booking i in bookings)
            {
                context.Bookings.Add(i);
            }
            context.SaveChanges();
// FacilitieList
            var facilitieLists = new FacilitieList[]
            {
                new FacilitieList {
                    FacilityID   = 1,
                    FacilityDesc = "Jacuzzi"
                }
            };

            foreach (FacilitieList i in facilitieLists)
            {
                context.FacilitieLists.Add(i);
            }
            context.SaveChanges();
// PaymentMethod
            var paymentMethods = new PaymentMethod[]
            {
                new PaymentMethod {
                    PaymentMethodID   = 1,
                    PaymentMethodDesc = "Debit Card"
                }
            };

            foreach (PaymentMethod i in paymentMethods)
            {
                context.PaymentMethods.Add(i);
            }
            context.SaveChanges();
// Payment
            var payments = new Payment[]
            {
                new Payment {
                    PaymentID       = 1,
                    BookingID       = bookings.Single(c => c.BookingID == 10).BookingID,
                    CustomerID      = customers.Single(c => c.CustomerID == 100).CustomerID, //PEdro
                    PaymentMethodID = paymentMethods.Single(p => p.PaymentMethodID == 1).PaymentMethodID,
                    PaymentAmount   = 5000,
                    PaymentComments = "Todo en orden"
                }
            };

            foreach (Payment i in payments)
            {
                context.Payments.Add(i);
            }
            context.SaveChanges();
// Guests

            var guests = new Guest[]
            {
                new Guest {
                    GuestID                = 123,
                    GuestTitle             = "Teacher",
                    GuestForenames         = "Perez",
                    GuestSurnames          = "Pancho",
                    GuestDOB               = DateTime.Parse("1996-09-01"),
                    GuestAddressStreet     = "Calle primavera 5",
                    GuestAddressTown       = "Zacatecas",
                    GuestAddressCountry    = "Mexico",
                    GuestAddressPostalCode = "98600",
                    GuestContactPhone      = "1651254305"
                }
            };

            foreach (Guest i in guests)
            {
                context.Guests.Add(i);
            }
            context.SaveChanges();
// RoomType

            var roomtypes = new RoomType[]
            {
                new RoomType {
                    RoomTypeID   = 1,
                    RoomTypeDesc = "Suite 5 stars"
                }
            };

            foreach (RoomType i in roomtypes)
            {
                context.RoomTypes.Add(i);
            }
            context.SaveChanges();

// RoomBand
            var roomBands = new RoomBand[]
            {
                new RoomBand {
                    RoombandID = 1,
                    BandDesc   = "5 beds"
                }
            };

            foreach (RoomBand i in roomBands)
            {
                context.RoomBands.Add(i);
            }
            context.SaveChanges();

// RoomPrice
            var roomPrices = new RoomPrice[]
            {
                new RoomPrice {
                    RoomPriceID   = 1,
                    RoomPriceDesc = 5000
                },
                new RoomPrice {
                    RoomPriceID   = 2,
                    RoomPriceDesc = 2500
                }
            };

            foreach (RoomPrice i in roomPrices)
            {
                context.RoomPrices.Add(i);
            }
            context.SaveChanges();



// Rooms *
            var rooms = new Room[]
            {
                new Room {
                    RoomID          = 502,
                    RoomTypeID      = roomtypes.Single(c => c.RoomTypeID == 1).RoomTypeID,
                    RoomBandID      = roomBands.Single(i => i.RoombandID == 1).RoombandID,
                    RoomPriceID     = roomPrices.Single(r => r.RoomPriceID == 2).RoomPriceID,
                    Floor           = "5th Floor",
                    AdditionalNotes = "Excellent View"
                }
            };

            foreach (Room i in rooms)
            {
                context.Rooms.Add(i);
            }
            context.SaveChanges();

// RoomFacility
            var roomFacilities = new RoomFacility[]
            {
                new RoomFacility {
                    RoomID          = rooms.Single(c => c.RoomID == 502).RoomID,
                    FacilityID      = facilitieLists.Single(c => c.FacilityID == 1).FacilityID,
                    FacilityDetails = "Realizado con exito",
                }
            };

            foreach (RoomFacility i in roomFacilities)
            {
                context.RoomFacilities.Add(i);
            }
            context.SaveChanges();

//BookingRoom
            var bookingRooms = new BookingRoom[]
            {
                new BookingRoom {
                    BookingID = bookings.Single(c => c.BookingID == 10).BookingID,
                    RoomID    = rooms.Single(c => c.RoomID == 502).RoomID,
                    GuestID   = guests.Single(c => c.GuestID == 123).GuestID
                }
            };

            foreach (BookingRoom i in bookingRooms)
            {
                context.BookingRooms.Add(i);
            }
            context.SaveChanges();
        }