Esempio n. 1
0
        public async Task <IActionResult> CreateBookingRequest(
            [FromRoute] Guid facilityId,
            [FromBody] CreateBookingRequestDto request,
            [FromServices] IOptions <EventBusOptions> options)
        {
            var bookingId = await mediator.Send(new CreateBookingRequestCommand(request.CustomerId, facilityId, request.BookedRecords, options.Value.Exchanges));

            return(Accepted());
        }
Esempio n. 2
0
        public async Task <Guid> Create(CreateBookingRequestDto request)
        {
            var bookingRequest = new BookingRequest
            {
                ItemId    = request.ItemId,
                UserId    = request.UserId,
                StartDate = request.StartDate,
                EndDate   = request.EndDate,
                Comment   = request.Comment,
            };

            await _repository.Create(bookingRequest);

            await _context.SaveChangesAsync();

            return(bookingRequest.Id);
        }
Esempio n. 3
0
        public async Task <ActionResult> CreateBookingRequest([FromBody] CreateBookingRequestDto request)
        {
            var result = await _service.Create(request);

            return(CreatedAtAction("GetBookingRequests", result));
        }