예제 #1
0
        public async Task <IActionResult> OnPostAddToCartAsync([FromQuery] string bookedDateId)
        {
            var bookedDate = await bookingService.GetBookedDate(bookedDateId);

            if (bookedDate == null)
            {
                this.ErrorPage();
            }

            var bookingCartItem = HttpContext.IsAuthenticated()
            ? await userBookingCart.AddToCart(bookedDate)
            : await sessionBookingCart.AddToCart(bookedDate);

            return(bookingCartItem != null
                ? (IActionResult)RedirectToPage("/Cart", new { area = "Cart" })
                : this.ErrorPage());
        }