Ejemplo n.º 1
0
        public async Task <bool> Checkout(ReservationInputDto input)
        {
            if (string.IsNullOrEmpty(input.ReservationId))
            {
                if (string.IsNullOrEmpty(input.ReservationId))
                {
                    return(false);
                }
            }

            var reservation = await _reservationRepository.FindAsync(input.ReservationId);

            if (reservation == null)
            {
                return(false);
            }

            //add chosen services
            input.Services
            .Where(s => s.Enabled).ToList()
            .ForEach(s => reservation.BillableServices.Add(Mapper.Map <BillableService>(s)));

            reservation.CheckedOut = true;

            await _uow.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Checkout(ReservationInputDto input)
        {
            var res = await _bll.Checkout(input);

            if (!res)
            {
                return(new NotFoundResult());
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(ReservationInputDto input)
        {
            if (!ModelState.IsValid)
            {
                return(View(input));
            }

            await _bll.Create(input);

            return(Redirect("Index"));
        }
Ejemplo n.º 4
0
        public async Task Create(ReservationInputDto input)
        {
            var room = await _roomRepository.FindAsync(input.SelectedRoomId);

            var reservation = Mapper.Map <Reservation>(input);

            reservation.RoomDescription = room.Name;

            await _reservationRepository.InsertAsync(reservation);

            await _uow.SaveChangesAsync();
        }