Esempio n. 1
0
 public void CreateReservationDetail(IEnumerable <ReservationDetail> rdml)
 {
     try
     {
         foreach (var item in rdml.ToList())
         {
             _reservationDetailRepository.Add(item);
         }
         _reservationDetailRepository.Commit();
     }
     catch { throw; }
 }
 public CreateResponse Create(ReservationRequest request)
 {
     try
     {
         var reservation = TypeAdapter.Adapt <Reservation>(request);
         _reservationValidator.ValidateAndThrowException(reservation, "Base,Create");
         _reservationRepository.Add(reservation);
         var reservationDetails = _reservationDetailFactory.BySaucer(reservation.SaucerId);
         reservationDetails.ForEach(reservationDetail =>
         {
             reservationDetail.ReservationId = reservation.Id;
             _reservationDetailRepository.Add(reservationDetail);
         });
         return(new CreateResponse(reservation.Id));
     }
     catch (DataAccessException)
     {
         throw new ApplicationException();
     }
 }