Пример #1
0
        public async Task <Review> AddLodgmentReviewAsync(int id, Review reviewModel)
        {
            var booking = await bookingService.GetBookingStatusAsync(reviewModel.ConfirmationCode);

            if (booking == null)
            {
                throw new KeyNotFoundException("El código de reserva no existe.");
            }

            var review = await repository.GetReviewAsync(reviewModel.ConfirmationCode);

            if (review != null)
            {
                throw new ArgumentException("El código de reserva ya fue usado.");
            }
            reviewModel.LodgmentId = id;
            reviewModel.Name       = booking.Name;

            review = await repository.AddLodgmentReviewAsync(reviewModel);

            return(review);
        }