public void StartRide(Scooter scooter) { if (scooter.IsRented || _activeRides.ContainsKey(scooter.Id)) { throw new ScooterRentalInProgressException($"Scooter \"{scooter.Id}\" already rented."); } _activeRides.Add(scooter.Id, new Ride(scooter, DateTime.Now)); scooter.IsRented = true; }
public Ride(Scooter scooter, DateTime startTime) { Scooter = scooter; StartTime = startTime; }