public ActionResult Delete(int id) { var rezervasyon = _reservationManager.Find(i => i.Id == id); _reservationManager.Delete(rezervasyon); return(RedirectToAction("Index", "Reservation")); }
private void DeleteReservation(Reservation reservation) { if (reservation != default(Reservation) && MessageBox.Show("Wollen Sie diese Reservation wirklich löschen?", "Löschen", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { try { resManager.Delete(reservation); Reservationen.Remove(reservation); } catch (DatabaseChangeException) { displayer.DisplayError("Fehler beim Löschen", "Der Eintrag konnte nicht aus der Datenbank gelöscht werden!"); } catch (OptimisticConcurrencyException <Auto> ) { displayer.DisplayError("Fehler beim Löschen", "Es ist ein Nebenläufigkeitsproblem aufgetreten. Bitte versuchen Sie es erneut."); } catch (EntityNotFoundException) { Reservationen.Remove(reservation); displayer.DisplayError("Fehler beim Löschen", "Der zu löschende Eintrag existiert nicht in der Datenbank."); } Empty = Reservationen.Count == 0; } }
public override async Task <Empty> Delete(ReservationDto request, ServerCallContext context) { ReservationManager manager = new ReservationManager(); Reservation reservation = request.ConvertToEntity(); await manager.Delete(reservation); return(new Empty()); }
public override async Task <Empty> DeleteReservation(ReservationDto request, ServerCallContext context) { Reservation reservation = request.ConvertToEntity(); await _reservationManager.Delete(reservation); Empty empt = new Empty(); return(empt); }
public async Task DeleteReservationTest() { // arrange Reservation = await _target.Get(1); // act await _target.Delete(Reservation); var ex = await Assert.ThrowsAsync <KeyNotFoundException>(async() => await _target.Get(Reservation.ReservationNr) ); }
public void DeleteReservation(ReservationDto reservationToBeDeleteed) { WriteActualMethod(); try { reservationManager.Delete(reservationToBeDeleteed.ConvertToEntity()); } catch (OptimisticConcurrencyException <Reservation> ) { OptimisticConcurrencyFault ocf = new OptimisticConcurrencyFault { Operation = "Delete", ProblemType = "Optimstic Cocurrency Error during deleting on Reservation!" }; throw new FaultException <OptimisticConcurrencyFault>(ocf); } }
public override async Task <Empty> Delete(ReservationDto request, ServerCallContext context) { try { ReservationManager manager = new ReservationManager(); await manager.Delete(request.ConvertToEntity()); return(new Empty()); } catch (OptimisticConcurrencyException <Reservation> e) { throw new RpcException(new Status(StatusCode.Aborted, e.Message)); } }
public ActionResult Delete(int id) { Car car = carManager.Find(x => x.Id == id); if (car.IsActive == false) { reservationManager.Delete(reservationManager.Find(x => x.CarID == id)); reservationManager.Save(); } carManager.Delete(car); carManager.Save(); return(RedirectToAction("Index", "Car")); }
public void DeleteReservation(ReservationDto reservation) { WriteActualMethod(); var reservationEntity = DtoConverter.ConvertToEntity(reservation); try { reservationManager.Delete(reservationEntity); } catch (OptimisticConcurrencyException <Reservation> ) { throw new FaultException <DataManipulationFault>(new DataManipulationFault { Message = "Die Reservation wird momentan bearbeitet." }); } }
public void RemoveReservation(ReservationDto reservation) { WriteActualMethod(); IAutoReservationResultCallback cb = _createCallbackChannel(); try { cb.SendReservation(reservationManager.Delete(reservation.ConvertToEntity()).ConvertToDto()); } catch (Exception ex) { cb.SendFault(new CommunicationFault { Exception = ex.Message }); } }
public void DeleteReservation(ReservationDto reservation) { WriteActualMethod(); try { _reservationManager.Delete(reservation.ConvertToEntity()); } catch (OptimisticConcurrencyException <Reservation> ex) { throw new FaultException <AutoReservationFault>(new AutoReservationFault { ErrorCode = AutoReservationFault.DataHasBeenModifiedInMeantime, ErrorMessage = $"Database Entity-State: {ex.MergedEntity.ConvertToDto()}" }); } }