public void Process(CarDatabase cars) { if (ReadAll) { var carsArray = cars.GetCars(); for (int n = 1; n <= carsArray.Length; n++) { Console.WriteLine(String.Format("{0}. {1}", n, carsArray[n - 1])); } } else { for (int n = 1; n <= Vins.Length; n++) { Car car = cars.Get(Vins[n - 1]); if (car != null) { Console.WriteLine(String.Format("{0}. {1}", n, car)); } else { Console.WriteLine(String.Format("{0}. The car with specified VIN \"{1}\" is not found in the database", n, Vins[n - 1])); } } } }
public void Process(CarDatabase cars) { var car = cars.Get(m_vin); if (car == null) { throw new Exception(String.Format("The car with specified VIN \"{0}\" is not found in the database", m_vin)); } if (m_newDateTime.HasValue) { car.IssueDate = m_newDateTime.Value; } if (m_newCarTypeInitialized) { car.CarType = m_newCarType; } if (m_newVendor != null) { car.Vendor = m_newVendor; } if (m_newModel != null) { car.Model = m_newModel; } }