public override async Task <Empty> Delete(AutoDto request, ServerCallContext context) { AutoManager manager = new AutoManager(); Auto car = request.ConvertToEntity(); await manager.Delete(car); return(new Empty()); }
public void DeleteAutoTest() { AutoManager autoManager = new AutoManager(); Auto auto = autoManager.Auto(1); autoManager.Delete(auto); autoManager.Auto(1); }
public void DeleteAutoOptimisticConcurrencyTest() { AutoManager autoManager = new AutoManager(); Auto auto = new LuxusklasseAuto { Id = 3, Marke = "Tesla", Tagestarif = 320, Basistarif = 10 }; autoManager.Delete(auto); }
public void DeleteAuto(AutoDto autoToBeDeleteed) { WriteActualMethod(); try { autoManager.Delete(autoToBeDeleteed.ConvertToEntity()); } catch (OptimisticConcurrencyException <Auto> ) { OptimisticConcurrencyFault ocf = new OptimisticConcurrencyFault { Operation = "Delete", ProblemType = "Optimstic Cocurrency Error during deleting on Auto!" }; throw new FaultException <OptimisticConcurrencyFault>(ocf); } }
public override async Task <Empty> Delete(AutoDto request, ServerCallContext context) { try { AutoManager manager = new AutoManager(); await manager.Delete(request.ConvertToEntity()); return(new Empty()); } catch (OptimisticConcurrencyException <Auto> e) { throw new RpcException(new Status(StatusCode.Aborted, e.Message)); } }
public void DeleteAuto(AutoDto auto) { WriteActualMethod(); var autoEntity = DtoConverter.ConvertToEntity(auto); try { autoManager.Delete(autoEntity); } catch (OptimisticConcurrencyException <Auto> ) { throw new FaultException <DataManipulationFault>(new DataManipulationFault { Message = "Das Auto wird momentan bearbeitet." }); } }
public void RemoveAuto(AutoDto auto) { WriteActualMethod(); IAutoReservationResultCallback cb = _createCallbackChannel(); try { cb.SendAuto(autoManager.Delete(auto.ConvertToEntity()).ConvertToDto()); } catch (Exception ex) { cb.SendFault(new CommunicationFault { Exception = ex.Message }); } }
public void DeleteAuto(AutoDto car) { WriteActualMethod(); try { _autoManager.Delete(car.ConvertToEntity()); } catch (OptimisticConcurrencyException <Auto> ex) { throw new FaultException <AutoReservationFault>(new AutoReservationFault { ErrorCode = AutoReservationFault.DataHasBeenModifiedInMeantime, ErrorMessage = $"Database Entity-State: {ex.MergedEntity.ConvertToDto()}" }); } }
private void DeleteAuto(Auto auto) { if (auto != default(Auto) && displayer.DisplayDialog("Löschen", "Wollen Sie diesen Eintrag wirklich löschen?")) { try { autoManager.Delete(auto); Autos.Remove(auto); } 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) { Autos.Remove(auto); displayer.DisplayError("Fehler beim Löschen", "Der zu löschende Eintrag existiert nicht in der Datenbank."); } Empty = Autos.Count == 0; } }
public override async Task <Empty> Delete(AutoDto request, ServerCallContext context) { await CarManager.Delete(request.ConvertToEntity()); return(new Empty()); }