예제 #1
0
        public async Task <ActionResult> SaveTripBookingAccommodationAsync(AccommodationBookingViewModel model)
        {
            var accommodation = new TripBookingAccommodation()
            {
                Kids              = model.Kids,
                Adults            = model.Adults,
                TownOrCity        = model.TownOrCity,
                AccommodationType = model.AccommodationType,
                CheckinDate       = model.CheckinDate,
                CheckoutDate      = model.CheckoutDate,
                TravellerNotes    = model.TravellerNotes,
                SpecialRequests   = model.SpecialRequests,
                Status            = AccommodationBookingStatus.requested.ToString(),
                TripId            = model.TripId,
                TripStepId        = model.TripStepId
            };

            var blError = await TripManager.SaveTripBookingAccommodationAsync(accommodation);

            if (blError.ErrorCode == 0)
            {
                return(RedirectToAction("ViewTrip", new { @tripId = model.TripId }));
            }
            else
            {
                ModelState.AddModelError("blError.ErrorMessage", blError.ErrorMessage);
                return(View("AccommodationBooking", model));
            }
        }