public async Task <IActionResult> OnPostBookDateAsync([Bind] BookingDateDto bookingDateModel) { string offerId = bookingDateModel.OfferId; if (!ModelState.IsValid) { return(await this.OnGetAsync(offerId)); } if (!bookingValidationService.ValidateDates(bookingDateModel.StartDate, bookingDateModel.EndDate)) { Alertify.Push("End date must be greater than start date", AlertType.Error); return(await this.OnGetAsync(offerId)); } var bookedDate = await bookingService.BookDate(bookingDateModel.StartDate, bookingDateModel.EndDate, offerId); if (bookedDate != null) { Log.Information($"User #{HttpContext.GetCurrentUserId()} booked offer #{offerId} from {bookingDateModel.StartDate.ToShortDateString()} to {bookingDateModel.EndDate.ToShortDateString()}"); return((IActionResult)RedirectToPage("/BookingSummary", new { area = "Bookings", id = bookedDate.Id })); } return(await this.OnGetAsync(offerId)); }
public IViewComponentResult Invoke(BookingDateDto input) => View(input);