コード例 #1
0
        public async Task <ActionResult> AddReservation([FromBody] PostReservationRequest reqest)
        {
            var reservation = _mapper.Map <Reservation>(reqest);

            reservation.Status = ReservationStatus.Pending;
            _context.Reservations.Add(reservation);
            await _context.SaveChangesAsync();

            var response = _mapper.Map <ReservationDetailsResponse>(reservation);
            await _reservationLogger.WriteAsync(reservation);

            return(CreatedAtRoute("reservations#getbyid", new { id = response.Id }, response));
        }
コード例 #2
0
        public async Task <ActionResult> AddReservation([FromBody] PostReservationRequest request)
        {
            var reservation = _mapper.Map <Reservation>(request);

            reservation.Status = ReservationStatus.Pending;
            _context.Reservations.Add(reservation);
            await _context.SaveChangesAsync();

            var response = _mapper.Map <ReservationDetailsResponse>(reservation);
            await _reservationsLogger.WriteAsync(reservation);

            //await Task.Delay(response.Items.Split(',').Count() * 1000);
            //response.AvailableOn = DateTime.Now.AddDays(1);

            return(CreatedAtRoute("reservations#getbyid", new { id = response.Id }, response));
        }