public bool TryUpdate(Car car) { Car oldCar; if (_carsDictionary.TryGetValue(car.Id, out oldCar)) { return _carsDictionary.TryUpdate(car.Id, car, oldCar); } return false; }
public Car Add(Car car) { lock (_incLock) { car.Id = _nextId; _carsDictionary.TryAdd(car.Id, car); _nextId++; } return car; }