Exemple #1
0
        public async Task <ActionResult <Booking> > CreateBookingAsync(BookingCreateDto bookingCreateDto)
        {
            var bookingModel = _mapper.Map <Booking>(bookingCreateDto);
            await _repository.CreateAsync(bookingModel);

            await _repository.SaveChangesAsync();

            var bookingReadDto = _mapper.Map <BookingReadDto>(bookingModel);

            return(CreatedAtRoute(nameof(GetBookingAsync), new { bookingReadDto.Id }, bookingReadDto));
        }