Пример #1
0
        public async Task <ActionResult <ReservationDetailDTO> > GetReservation([FromQuery] ReservationIndexDTO reservationIndexDTO)
        {
            if (!ModelState.IsValid)
            {
                return(ValidationProblem(ModelState));
            }

            try
            {
                var foundReservation = await _rentService.GetReservation(reservationIndexDTO);

                return(Ok(foundReservation));
            }
            catch (ArgumentNullException)
            {
                return(NotFound("Reservation not found"));
            }
            catch (Exception exception)
            {
                return(BadRequest(exception.Message));
            }
        }