Exemple #1
0
        public Car SellCar(int id)
        {
            Car    car = null;
            string msg;

            if (OrderedCars.ContainsKey(id))
            {
                car = OrderedCars[id];
                OrderedCars.Remove(id);
                msg = "car sold:" + car.ToString();
            }
            else
            {
                msg = "not foundl";
            }
            Console.WriteLine(msg);
            return(car);
        }
Exemple #2
0
        public Car DriveTest(int id)
        {
            Car car = null;

            if (OrderedCars.ContainsKey(id))
            {
                car = OrderedCars[id];
                TestDriveCars[id] = car;
                OrderedCars.Remove(id);
            }
            else if (TestDriveCars.ContainsKey(id))
            {
                car = TestDriveCars[id];
            }

            if (car != null)
            {
                car.Kilometers += 20;
            }
            return(car);
        }