/// <summary> /// Add the car to Car database /// </summary> public void AddCarToWarehouse(SerializableCar car) { if (CarDatabase.Contains(car) == false) { CarDatabase.Add(car); UpdateXmlDatabase(CarDatabase, CarsXmlFileName); } else { throw new ArgumentException("this car already exists in database"); } }
/// <summary> /// Search the car by serial number and then remove it from Car database /// </summary> public void RemoveCarFromWarehouse(string serialNumber) { SerializableCar removedCar = (CarDatabase.Where(t => t.SerialNumber == serialNumber)).First(); if (removedCar != null) { CarDatabase.Remove(removedCar); UpdateXmlDatabase(CarDatabase, CarsXmlFileName); } else { throw new ArgumentException("Car with this serial number is not found in database"); } }