예제 #1
0
 internal bool DeleteReservation(Reservation reservation, int reservationID)
 {
     if (IsReservationInDataBase(reservation))
     {
         if (ReservationRepository.DeleteReservation(reservationID))
         {
             Reservations.Remove(reservation);
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
        public IActionResult DeleteReservation(int RoomId, int reservationId)
        {
            base.CheckForLogin();
            if (!base.CheckForRight(3))
            {
                return(RedirectToAction("Index", "Home"));
            }

            ReservationRepository repo = new ReservationRepository(new ReservationSQLContext());

            repo.DeleteReservation(reservationId);
            List <Room> rooms = new ReservationRepository(new ReservationSQLContext()).GetRooms();

            return(RedirectToAction("LoadReservations", new { roomId = RoomId }));
        }
        public IActionResult CancelReservation()
        {
            var currReservationViewModel = _sessionService.GetFromSession <ReservationViewModel>(HttpContext, ReservationViewModel.SessionKey);

            try
            {
                if (!_reservationRepo.DeleteReservation(currReservationViewModel.ConfirmationNumber))
                {
                    return(StatusCode(400));
                }
            }
            catch (Exception)
            {
                return(StatusCode(400));
            }


            return(View(currReservationViewModel));
        }
예제 #4
0
        public void Test_deleteReservation()
        {
            List <Reservation> resultRes = new List <Reservation>();

            Reservation           testI = new Reservation();
            ReservationRepository reservationRepository = new ReservationRepository();

            Reservation testInfo = new Reservation();

            testInfo.code     = 1;
            testInfo.date     = "13.12.2020";
            testInfo.time     = "8:00";
            testInfo.username = "******";

            reservationRepository.DeleteReservation(testInfo);

            resultRes = reservationRepository.GetAllReservations();

            Assert.IsFalse(resultRes.Contains(testInfo));
        }
        public IActionResult CancelReservation()
        {
            var reservationToCancel = GetReservationFromSession("updatecancelwizard");

            if (reservationToCancel != null)
            {
                try
                {
                    if (!_reservationRepository.DeleteReservation(reservationToCancel))
                    {
                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                    ModelState.AddModelError(string.Empty, "Reservation Could not be deleted");
                    return(RedirectToAction("UpdateCancelReservation", reservationToCancel));
                }
            }
            return(RedirectToAction("CancelReservationComplete", reservationToCancel));
        }
 public ActionResult DeleteConfirmed(int CarId, int CustomerId)
 {
     reservationRepository.DeleteReservation(CarId, CustomerId);
     return(RedirectToAction("Index"));
 }
예제 #7
0
 public void DeleteReservation(Reservation reservation)
 {
     reservationRepository.DeleteReservation(reservation);
 }
예제 #8
0
 public IActionResult DeleteReservation(int id)
 {
     return(new OkObjectResult(_reservationRepo.DeleteReservation(id)));
 }
예제 #9
0
 public void DeleteReservation(int id)
 {
     reservationRepository.DeleteReservation(id);
 }