Esempio n. 1
0
        public async Task <IActionResult> OnPostBuyTickets()
        {
            var newUser = new AppUser()
            {
                Name  = UserBooking.User.Name,
                Email = UserBooking.User.Email
            };

            var userContent = await clientHelper.PostAsync("appusers", newUser);

            var user = await userContent.ReadAsAsync <AppUser>();


            foreach (var seatModel in MovieScreen.Screen.Seats)
            {
                var seat = new Seat
                {
                    SeatId = seatModel.SeatId,
                    Title  = seatModel.Title
                };

                var newBooking = new Booking()
                {
                    UserId = user.AppUserId,
                    SeatId = seat.SeatId,
                };

                var bookingContent = await clientHelper.PostAsync("Bookings", newBooking);

                var booking = await bookingContent.ReadAsAsync <Booking>();
            }


            return(Redirect($"/Basket/Confirmation/{newUser.AppUserId}"));
        }