Esempio n. 1
0
        public async Task <int> BookFlight(BookingModel model)
        {
            try
            {
                var flightbookingId = await _bookingRepository.BookFlight(new Bookings()
                {
                    FlightNumber  = model.FlightNumber,
                    CreatedDate   = model.CreatedDate,
                    BookingStatus = model.BookingStatus,
                    TransactionId = model.TransactionId
                });

                _flightEventProducer.SendOrderDoneMessage(new FlightOrderConfirmedMessage()
                {
                    TransactionId   = model.TransactionId,
                    FlightBookingId = flightbookingId
                });

                return(flightbookingId);
            }
            catch (Exception e)
            {
                _flightEventProducer.SendOrderNotCompleterdMessage(model.TransactionId);
                Console.WriteLine(e);
                return(-1);
            }
        }