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 bool AddDriver(string dni, string name, string lastName, int point) { RpDrivers rpDrivers = new RpDrivers(); if (!rpDrivers.checkExistDNI(dni)) { Driver NewDriver = new Driver(dni, name, lastName, point); return(rpDrivers.AddDriver(NewDriver)); } else { return(false); } }