public void AddNewVehicle(string registrationNumber) { IVehicle.VehicleTypes type = GarageHandler.GetVehicleType(); string modelVehicle = GarageHandler.GetModelName(); Color.ColorCars color = GarageHandler.GetColor(); Vehicles newVehicle; newVehicle = iVehicle.CreateVehicle(registrationNumber, modelVehicle, type, color); GarageHandler.SetColor(newVehicle); AddNewVehicleGarage(newVehicle); }
public static void SetColor(Vehicles vehiclecolor) { Color.ColorCars color; Type vehicleType = vehiclecolor.GetType(); PropertyInfo colorPropertyInfo = vehicleType.GetProperty("ColorCar"); if (colorPropertyInfo != null) { color = GarageHandler.GetColor(); colorPropertyInfo.SetValue(vehiclecolor, color, null); } }