public HotelModel(SearchResultHotel hotel) { Name = hotel.Name; About = hotel.About; CheckIn = hotel.CheckIn; CheckOut = hotel.CheckOut; }
//public CheckoutBillingInformationModel(Reservation reservation) //{ // Hotel = reservation.HotelName; // Arrival = reservation.Arrival; // Departure = reservation.Departure; // Firstname = reservation.Firstname; // Lastname = reservation.Lastname; // PhoneNumber = reservation.PhoneNumber; // SelectedCountryName = reservation.Country ?? string.Empty; // Email = reservation.Email; // TotalPrice = Money.Create(reservation.TotalPrice, Currency.Create("DKK", 10, "DKK", 0.0m)); // Rooms = reservation.Items.Select(x => new CheckoutRoomInformationModel(x)).ToList(); //} public CheckoutBillingInformationModel(Reservation reservation, SearchResultHotel searchResultHotel, IEnumerable<Addon> addons, IEnumerable<Country> countries) { Hotel = reservation.HotelName; Arrival = reservation.Arrival; Departure = reservation.Departure; Firstname = reservation.Firstname; Lastname = reservation.Lastname; //PhoneNumber = reservation.Phonenumber; SelectedCountryName = reservation.Country ?? string.Empty; Email = reservation.Email; TotalPrice = Money.Create(reservation.TotalPrice, Currency.Create("DKK", 10, "DKK", 0.0m)); Rooms = new List<CheckoutRoomInformationModel>(); foreach (var reservationItem in reservation.Items) { var roomtype = searchResultHotel.Rooms.FirstOrDefault(x => x.RoomTypeId == reservationItem.RoomTypeId); var roomInformationModel = new CheckoutRoomInformationModel(reservationItem, roomtype, addons); Rooms.Add(roomInformationModel); } if(Rooms.Count == 1) { Rooms[0].NameOfPrimaryGuest = reservation.Fullname; } AvailableCountries = countries.Select(x => new SelectListItem { Selected = x.Name.Trim() == SelectedCountryName.Trim(), Text = x.Name.Trim(), Value = x.Name.Trim() }).ToList(); AvailableCountries.Insert(0, new SelectListItem { Selected = false, Text = "Choose one..", Value = string.Empty }); }