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); }
public async Task <IActionResult> Checkout(ReservationInputDto input) { var res = await _bll.Checkout(input); if (!res) { return(new NotFoundResult()); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Create(ReservationInputDto input) { if (!ModelState.IsValid) { return(View(input)); } await _bll.Create(input); return(Redirect("Index")); }
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(); }