public bool AddVehicleToDrive(string registration, string brand, string model, string dni) { RpVehicles rpVehicle = new RpVehicles(); RpDrivers rpDrivers = new RpDrivers(); try { //TODO Validar matrĂcula antes de agregar el vehĂculo rpVehicle.AddVehicle if (!rpVehicle.checkExistVehicle(registration) && rpDrivers.checkExistDNI(dni)) { Driver conductor = rpDrivers.GetDriver(dni); vehicle car = new vehicle(registration, brand, model); if (rpVehicle.AddVehicle(car)) { return(conductor.addVehicle(car)); } else { throw new Exception(); } } else { return(false); } } catch (Exception ex) { return(false); } }
public Driver GetDriver(string DNI) { RpDrivers rpDrivers = new RpDrivers(); return(rpDrivers.GetDriver(DNI)); }