public ActionResult ConfirmReservationSubmit(ReservationParameters model) { model.AcceptTermsAndConditions = (HttpContext.Request.Form["confirm_toc"] != null); ReservationParameters reservationContext = ReservationUtils.GetContextReservation(); Session["PPPUiError"] = null; ValidationUtils.ClearModelErrors(ModelState); reservationContext = ReservationUtils.MapGuestValues(model, reservationContext); // var errors = ValidationUtils.GetGuestViolations(model, reservationContext.MaxOccupancy); var errors = new List <RuleViolation>(); if (!ValidationUtils.ErrorsDetected(ModelState, errors)) { Session["ReservationContext"] = reservationContext; var reservationResponse = ExecuteBook(reservationContext); if (reservationResponse != null && reservationResponse.Errors == null) { OwnerUtils.SetContextToReloadPalett(); Session["ReservationNumber"] = reservationResponse.ConfirmReservation.ReservationNumber; Response.Redirect("/owner/Points-Protection-Plan", false); return(null); } else { ModelState.AddModelError("", "We're sorry, but since you began your search, that villa type is no longer available. Please select BACK to begin a new search."); } } return(base.Index()); }
public ActionResult BonusTimeReservationSubmit(ReservationParameters model) { model.AcceptTermsAndConditions = (HttpContext.Request.Form["confirm_toc"] != null); ReservationParameters reservationContext = ReservationUtils.GetContextReservation(); reservationContext.CreditCard_Type = FormatUtils.ConvertCreditCard(model.CreditCard_Type); //Required for the validation var listOfError = ValidationUtils.GetCreditCardViolations(model); listOfError.AddRange(ValidationUtils.GetAddressViolations(model)); listOfError.AddRange(ValidationUtils.GetGuestViolations(model, reservationContext.MaxOccupancy)); Session["ChangedCountry"] = null; if (listOfError.Count > 0) { Session["ChangedCountry"] = model.Address_Country; foreach (var vi in listOfError) { ModelState.AddModelError("", vi.ErrorMessage); } } else { reservationContext = ReservationUtils.MapGuestValues(model, reservationContext); reservationContext = ReservationUtils.MapAddressValues(model, reservationContext); reservationContext = ReservationUtils.MapCreditCardValues(model, reservationContext); var reservationResponse = ExecuteBook(reservationContext); if (reservationResponse != null && reservationResponse.Errors == null) { ReservationUtils.DeleteContextReservation(); //Response.Flush(); Response.Redirect("/owner/reservation-confirmation?type=Future&reservationNo=" + reservationResponse.ConfirmReservation.ReservationNumber, false); HttpContext.ApplicationInstance.CompleteRequest(); return(null); } else { ModelState.AddModelError("", "We're sorry, but since you began your search, that villa type is no longer available. Please select BACK to begin a new search."); } } return(base.Index()); }