public void WhenRemoveReservationToRepoRemoveFromUserAsWell() { Reservation testRes = new Reservation(_student, _room1, 4, _from, _to); _repoReserv.Add(testRes); _repoReserv.Delete(testRes); List <Reservation> UsersReservations = _student.GetReservations(); Assert.IsFalse(UsersReservations.Contains(testRes)); }
public void Create_WithValidData_SavesRecordInTheDatabase() { // Arrange var newReservation = sut.Create(reservation); // Assert Assert.IsNotNull(newReservation); Assert.IsTrue(newReservation.ReservationId != null); // CleanUp sut.Delete(reservation.ReservationId); }
private void DeleteButton_Click(object sender, EventArgs e) { try { Reservation reservation = (Reservation)bindingSourceReserve.Current; if (reservation == null) { return; } DialogResult result = MessageBox.Show( InfoMessages.DeleteConfirmation, GlobalConstants.DeleteConfirmationCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { repository.Delete(reservation); RefreshControls(); } } catch (Exception ex) { throw new ApplicationException(string.Format(ErrorMessages.ErrorMessageTemplate, ReservationDisplay), ex); } }
public ActionResult Delete(ReservationsDeleteViewModel model) { ReservationRepository repository = new ReservationRepository(); repository.Delete(model.ID); return(RedirectToAction("Index")); }
private void button1_Click(object sender, EventArgs e) { if (lstCustomers.SelectedIndex > -1) { customer = lstCustomers.SelectedItem as Customer; double borc = 0; foreach (Reservation r in customer.Reservations) { reservationRepository.Delete(r); r.Amount = 0; } lblBorc.Text = $"Customer's Cost Amount: { borc.ToString():C2}"; } }
public IHttpActionResult Delete(int id) { if (_reservationsTablePackagesController.DeleteByReservationId(id)) { if (_reservationRepository.Delete(id)) { return(Ok("Resevation was deleted")); } else { return(BadRequest("Something went wrong ..")); } } else { return(BadRequest("Something went wrong ..")); } }
public IActionResult Delete(int reservationId) { StringValues headerValues; var a = Request.Body; if (Request.Headers.TryGetValue("Authorization", out headerValues)) { string token_str = headerValues.First(); string[] token_arr = token_str.Split(" "); var handler = new JwtSecurityTokenHandler(); var token = handler.ReadJwtToken(token_arr[1]); var userId = token.Payload["unique_name"]; return(Ok(_reservationRepository.Delete(reservationId, int.Parse(userId.ToString())))); } return(BadRequest()); }
public void RemoveReservation(int id) { rrep.Delete(rrep.GetByID(id)); rrep.Save(); }
public void DeleteReservation() { _repoReservation.Delete(_reservation1); _reservationList = _repoReservation.Get(); Assert.IsFalse(_reservationList.Contains(_reservation1)); }
private void BtnDelete_Click(object sender, EventArgs e) { reservationRepository.Delete(reservation); LoadListBox(); }
public void DeleteReservation(Reservation reservation) { _reservRepo.Delete(reservation); }
public static void Delete(int id) => ReservationRepository.Delete(id);
internal void DeleteReservation(Reservation reservation) { _repoReservation.Delete(reservation); }