public AutoDto GetCar(int id) { WriteActualMethod(); AutoManager manager = new AutoManager(); return(DtoConverter.ConvertToDto(manager.GetAuto(id))); }
public List <AutoDto> GetAllCars() { WriteActualMethod(); AutoManager manager = new AutoManager(); return(DtoConverter.ConvertToDtos(manager.ListOfAutos)); }
public AutoDto InsertAuto(AutoDto auto) { WriteActualMethod(); AutoManager am = new AutoManager(); return(am.Insert(auto.ConvertToEntity()).ConvertToDto()); }
public AutoDto getCarById(int id) { WriteActualMethod(); AutoManager autoManager = new AutoManager(); return(DtoConverter.ConvertToDto(autoManager.getCarById(id))); }
public List <AutoDto> getAllCars() { WriteActualMethod(); AutoManager autoManager = new AutoManager(); return(DtoConverter.ConvertToDtos(autoManager.List)); }
private void btnGuardar_Click(object sender, EventArgs e) { ClienteVendedor nCliente = new ClienteVendedor(); nCliente.sNombre = txtNombre.Text; nCliente.sApellidos = txtApellidos.Text; nCliente.sINE = txtINE.Text; nCliente.sTelefono = txtTelefono.Text; nCliente.sCalle = txtCalle.Text; nCliente.sNumero = txtNumero.Text; nCliente.sEntreCalle = txtEntre.Text; nCliente.sColonia = txtColonia.Text; nCliente.sCiudad = txtCiudad.Text; nCliente.sEstado = txtEstado.Text; nCliente.sImagen = ucFotoCliente.ImagenString; int pkCliente = ClienteVendedorManager.GuardarNuevoCV(nCliente); Auto nAuto = new Auto(); nAuto.sFotoPrincipal = ucFotoPrincipal.ImagenString; nAuto.sFotoSecundaria = ucFotoSecundaria.ImagenString; nAuto.sFotoTercearia = ucFotoTercearia.ImagenString; nAuto.sMarca = txtMarca.Text; nAuto.sModelo = txtModelo.Text; nAuto.sNumeroSerie = txtNumeroSerie.Text; nAuto.iAnio = Convert.ToInt32(txtAnio.Text); nAuto.sDescripcion = txtComentario.Text; AutoManager.GuardarNuevoAuto(nAuto, pkCliente); int x = 0; }
public AutoDto UpdateAuto(AutoDto autoDto) { WriteActualMethod(); return(handlingOptimisticConcurrencyException <AutoDto>("UpdateAuto", () => AutoManager.UpdateAuto(autoDto.ConvertToEntity()).ConvertToDto() )); }
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 removeCar(AutoDto autoDto) { WriteActualMethod(); Auto auto = DtoConverter.ConvertToEntity(autoDto); AutoManager autoManager = new AutoManager(); autoManager.removeCar(auto); }
public AutoDetailViewModel(IMessageDisplayer displayer) { ChangeAutoType(AutoKlasse); SaveAutoCommand = new RelayCommand <Window>(param => SaveAuto(param)); CancelCommand = new RelayCommand <Window>(param => Cancel(param)); autoManager = new AutoManager(); this.displayer = displayer; }
public AutoReservationService(Func <IAutoReservationResultCallback> callbackCreator) { autoManager = new AutoManager(); kundeManager = new KundeManager(); reservationManager = new ReservationManager(); _createCallbackChannel = callbackCreator; }
public AutoViewModel(IMessageDisplayer displayer) { Autos = new ObservableCollection <Auto>(); AddNewAutoCommand = new RelayCommand <Auto>(param => SaveAuto(param)); RemoveAutoCommand = new RelayCommand <Auto>(param => DeleteAuto(param)); autoManager = new AutoManager(); this.displayer = displayer; }
public void DeleteAutoTest() { AutoManager autoManager = new AutoManager(); Auto auto = autoManager.Auto(1); autoManager.Delete(auto); autoManager.Auto(1); }
public override async Task <AutoDto> Insert(AutoDto request, ServerCallContext context) { AutoManager manager = new AutoManager(); Auto car = request.ConvertToEntity(); Auto newcar = await manager.Insert(car); return(newcar.ConvertToDto()); }
public override async Task <AutoDto> GetById(GetAutoByIdRequest request, ServerCallContext context) { AutoManager manager = new AutoManager(); Auto auto = await manager.GetById(request.Id); AutoDto result = auto.ConvertToDto(); return(result); }
public void DeleteAutoOptimisticConcurrencyTest() { AutoManager autoManager = new AutoManager(); Auto auto = new LuxusklasseAuto { Id = 3, Marke = "Tesla", Tagestarif = 320, Basistarif = 10 }; autoManager.Delete(auto); }
public override async Task <AutosDto> GetAll(Empty request, ServerCallContext context) { AutoManager manager = new AutoManager(); List <Auto> allCars = await manager.GetAll(); List <AutoDto> dtos = allCars.ConvertToDtos(); AutosDto autosDto = new AutosDto(); dtos.ForEach(autoDto => autosDto.Cars.Add(autoDto)); return(autosDto); }
public void UpdateAuto(AutoDto auto) { try { AutoManager.Update(auto.ConvertToEntity()); } catch (DbUpdateConcurrencyException) { var fault = new GenericFault("Update Concurrency Exception"); throw new FaultException <GenericFault>(fault); } }
public void UpdateAutoTest() { AutoManager autoManager = new AutoManager(); Auto auto = autoManager.Auto(1); auto.Marke = "Fiat Multipla"; auto.Tagestarif = 100; Auto updatedAuto = autoManager.Update(auto); Assert.AreEqual("Fiat Multipla", updatedAuto.Marke); Assert.AreEqual(100, updatedAuto.Tagestarif); }
public AutoDto GetAutoById(int id) { try { return(AutoManager.GetById(id).ConvertToDto()); } catch (InvalidOperationException) { var fault = new GenericFault("Keine Gültige ID"); throw new FaultException <GenericFault>(fault); } }
public void InsertAutoTest() { AutoManager autoManager = new AutoManager(); Auto auto = new MittelklasseAuto { Marke = "Opel Corsa", Tagestarif = 100 }; Auto insertedAuto = autoManager.Insert(auto); Assert.AreEqual(4, insertedAuto.Id); Auto getAuto = autoManager.Auto(4); Assert.AreEqual("Opel Corsa", getAuto.Marke); }
public void AddReservationTest() { KundeManager km = new KundeManager(); AutoManager am = new AutoManager(); Kunde k1 = km.GetKundeById(1); Auto a1 = am.GetAutoById(1); Reservation reservation = new Reservation { KundeId = k1.Id, AutoId = a1.Id, Von = new DateTime(2018, 12, 24), Bis = new DateTime(2018, 12, 27) }; Target.AddReservation(reservation); Assert.Equal(5, Target.GetReservations().Count); }
public override async Task <AllAutos> GetAll(Empty request, ServerCallContext context) { AutoManager manager = new AutoManager(); List <Auto> autoList = await manager.GetAll(); AllAutos allAutoDto = new AllAutos(); foreach (Auto k in autoList) { allAutoDto.Auto.Add(k.ConvertToDto()); } return(allAutoDto); }
public override async Task <AutoDto> Get(AutoRequest request, ServerCallContext context) { AutoManager manager = new AutoManager(); Auto car = await manager.Get(request.Id); if (car == null) { throw new RpcException(new Status( StatusCode.OutOfRange, "Id couldn't be found." )); } return(car.ConvertToDto()); }
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 UpdateAutoTest() { Auto myCar = AutoManager.GetAutoById(1); myCar.Marke = "Marke"; myCar.Tagestarif = 20; AutoManager.UpdateAuto(myCar); Auto sameCar = AutoManager.GetAutoById(1); Assert.Equal("Marke", myCar.Marke); Assert.Equal("Marke", sameCar.Marke); Assert.Equal(20, myCar.Tagestarif); Assert.Equal(20, sameCar.Tagestarif); }
public override async Task <AutoDto> Insert(AutoDto request, ServerCallContext context) { try { AutoManager manager = new AutoManager(); Auto auto = await manager.Insert(request.ConvertToEntity()); AutoDto result = auto.ConvertToDto(); return(result); } catch (OptimisticConcurrencyException <Auto> e) { throw new RpcException(new Status(StatusCode.Aborted, e.Message)); } }
public void InsertAndDeleteAutoTest() { Auto someCar = new LuxusklasseAuto { Marke = "DUDE!", Tagestarif = 10, Basistarif = 20 }; Auto neu = AutoManager.InsertAuto(someCar); Auto sameCar = AutoManager.GetAutoById(neu.Id); Assert.Equal("DUDE!", someCar.Marke); Assert.Equal("DUDE!", sameCar.Marke); AutoManager.DeleteAuto(neu); }
public override async Task <Empty> Update(AutoDto request, ServerCallContext context) { AutoManager manager = new AutoManager(); Auto car = request.ConvertToEntity(); try { await manager.Update(car); } catch (OptimisticConcurrencyException <Auto> exception) { throw new RpcException(new Status( StatusCode.Aborted, "Conccurency Exception." ), exception.ToString()); } return(new Empty()); }
public void modifyCar(AutoDto autoDto) { WriteActualMethod(); Auto auto = DtoConverter.ConvertToEntity(autoDto); AutoManager autoManager = new AutoManager(); try { autoManager.modifyCar(auto); } catch (OptimisticConcurrencyException <Auto> e) { OptimisticConcurrency <AutoDto> fault = new OptimisticConcurrency <AutoDto>(); fault.Result = false; fault.Message = e.Message; fault.Description = "Occurrency Exception!"; throw new FaultException <OptimisticConcurrency <AutoDto> >(fault); } }