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