예제 #1
0
        public bool CreateVehicle(int i_OptionSelected, List <object> i_VehicleInfoParams, VehicleOwner i_VehicleOwner)
        {
            bool          resultToReturn       = true;
            Vehicle       vehicleToCreate      = null;
            GarageVehicle vehicleToAddToGarage = null;

            resultToReturn = checkIfVehicleIsNotInGarage((string)i_VehicleInfoParams[1]);
            if (resultToReturn)
            {
                switch (i_OptionSelected)
                {
                case 1:
                    vehicleToCreate = new FuelMotorcycle(i_VehicleInfoParams);
                    break;

                case 2:
                    vehicleToCreate = new ElectricMotorcycle(i_VehicleInfoParams);
                    break;

                case 3:
                    vehicleToCreate = new FuelCar(i_VehicleInfoParams);
                    break;

                case 4:
                    vehicleToCreate = new ElectricCar(i_VehicleInfoParams);
                    break;

                case 5:
                    vehicleToCreate = new Truck(i_VehicleInfoParams);
                    break;
                }

                vehicleToAddToGarage = new GarageVehicle(i_VehicleOwner, vehicleToCreate);
                this.r_GarageInstance.AddNewVehicleToGarage(vehicleToAddToGarage);
            }

            return(resultToReturn);
        }
예제 #2
0
 public void AddNewVehicleToGarage(GarageVehicle i_VehicleToAdd)
 {
     this.r_GarageVehiclesList.Add(i_VehicleToAdd);
 }