Exemple #1
0
        public void BookShow(Guid?userId, string userName, Int64 showId, List <Int64> seatIds)
        {
            var user = _queryFactory.GetUserById(userId.GetValueOrDefault());

            if (user == null)
            {
                _commandFactory.UserAdd(new Models.User()
                {
                    Id = userId.GetValueOrDefault(), Name = userName
                });
            }
            foreach (var seat in seatIds)
            {
                var booking = _commandFactory.BookingAdd(new Models.Booking()
                {
                    SeatId = seat, ShowId = showId
                });
                _commandFactory.UserBookingAdd(new Models.UserBooking()
                {
                    BookingId = booking.Id, UserId = userId.GetValueOrDefault()
                });
            }
        }