Ejemplo n.º 1
0
        public async Task <string> CancelReservation(Guid id)
        {
            try
            {
                var filter = Builders <Reservation> .Filter.Eq("Id", id);

                var reservation = _reservation.Find(filter).FirstOrDefault();
                if (reservation == null)
                {
                    throw new Exception("Book doesn't existst");
                }

                var newTransferReservation = new CancelReservation()
                {
                    RoomId = reservation.RoomId
                };

                await _publicher.CancelPublish(newTransferReservation);


                _reservation.DeleteOne(Builders <Reservation> .Filter.Eq("Id", id));

                return("Reservation was canceled successfully");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }