public void Post([FromBody] ReserveModel value)
 {
     try
     {
         _reservationService.ReserveHotel(value);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
示例#2
0
        public async Task Handle(string eventName, string message)
        {
            switch (eventName)
            {
            case KafkaConstants.Place_Hotel_Order_Event:
                var hotelModel = _messageSerializer.DeSerialize <PlaceHotelOrderMessage>(message);
                _hotelReservationService.ReserveHotel(new ReserveModel()
                {
                    TransactionId     = hotelModel.TransactionId,
                    ReservationDate   = hotelModel.HotelReservationDate,
                    Price             = 20,
                    CreatedDate       = DateTime.Now,
                    ReservationStatus = "Done"
                });
                return;

            case KafkaConstants.Cancel_Hotel_Order_Event:
                _hotelReservationService.CancelReserveHotel(message);
                return;
            }
        }