internal bool DeleteReservation(Reservation reservation, int reservationID) { if (IsReservationInDataBase(reservation)) { if (ReservationRepository.DeleteReservation(reservationID)) { Reservations.Remove(reservation); return(true); } } return(false); }
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)); }
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")); }
public void DeleteReservation(Reservation reservation) { reservationRepository.DeleteReservation(reservation); }
public IActionResult DeleteReservation(int id) { return(new OkObjectResult(_reservationRepo.DeleteReservation(id))); }
public void DeleteReservation(int id) { reservationRepository.DeleteReservation(id); }