public void AddReservation(ReservationDto reservation)
 {
     WriteActualMethod();
     try
     {
         _reservationManager.Add(reservation.ConvertToEntity());
     }
     catch (OptimisticConcurrencyException <Reservation> )
     {
         throw new FaultException <OptimisticConcurrencyFault <Reservation> >(new OptimisticConcurrencyFault <Reservation>())
               {
               };
     }
     catch (InvalidDateRangeException)
     {
         throw new FaultException <InvalidDateRangeFault>(new InvalidDateRangeFault())
               {
               };
     }
     catch (UnavailableAutoException)
     {
         throw new FaultException <UnavailableAutoFault>(new UnavailableAutoFault())
               {
               };
     }
 }
Example #2
0
        public void AddReservation(ReservationDto reservation)
        {
            WriteActualMethod();
            var reservationEntity = DtoConverter.ConvertToEntity(reservation);

            try
            {
                reservationManager.Add(reservationEntity);
            }
            catch (InvalidDateRangeException e)
            {
                throw new FaultException <InvalidDateRangeFault>(new InvalidDateRangeFault {
                    Message = "Ungültiger Datumsbereich eingegeben.", MessageDetails = e.Message
                });
            }
            catch (AutoUnavailableException)
            {
                throw new FaultException <AutoUnavailableFault>(new AutoUnavailableFault {
                    Message = "Das gewählte Fahrzeug ist zur Zeit nicht verfügbar."
                });
            }
        }