コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: Ride.cs プロジェクト: ivisnauskis/ScooterRental
 public Ride(Scooter scooter, DateTime startTime)
 {
     Scooter   = scooter;
     StartTime = startTime;
 }