public async Task <IActionResult> GetReservationById([HttpTrigger(AuthorizationLevel.Function, "get", Route = "reservation/{hotelId}/{reservationId}")] HttpRequest req, Guid hotelId, Guid reservationId, CancellationToken cancellationToken, ILogger log)
        {
            try
            {
                var query = new FindReservationQuery {
                    HotelId = hotelId, ReservationId = reservationId
                };
                var result = await _bus.Send <FindReservationQuery, ReservationsReadModel>(query, cancellationToken);

                return(new OkObjectResult(result));
            }
            catch (Exception ex)
            {
                log.LogCritical(ex, ex.Message, new Dictionary <string, object> {
                    ["Request"] = req.Query.ToString()
                });
                return(new BadRequestObjectResult("Error occured on GetReservationByIdFunction.GetReservationById."));
            }
        }
Exemple #2
0
        public IEnumerable <Reservation> GetReservation(RequestBase request)
        {
            FindReservationQuery query = new FindReservationQuery(request.Document.Header.PrinterName, request.Document.Header.Channel);

            return(_queryProcessor.Handler <FindReservationQuery, IEnumerable <Reservation> >(query));
        }