/// <summary>
 /// checking out the vehicle
 /// </summary>
 /// <param name="licensePlateID">of the vehicle</param>
 /// <returns>true if check out succeed, else false</returns>
 public bool CheckOut(string licensePlateID)
 {
     if (OccupiedLots.ContainsKey(licensePlateID))
     {
         OccupiedLots[licensePlateID].freeLot();
         OccupiedLots.Remove(licensePlateID);
         return(true);
     }
     return(false);
 }
示例#2
0
        public Car Pick(string token)
        {
            if (!IsCarInLot(token))
            {
                throw new CarNotFoundException("Not found.");
            }
            var car = OccupiedLots[token];

            OccupiedLots.Remove(token);
            return(car);
        }
示例#3
0
        public string Park(Car car)
        {
            if (!HasEmptySpace())
            {
                throw new ParkingFailedException("No space.");
            }
            var token = Guid.NewGuid().ToString();

            OccupiedLots.Add(token, car);
            return(token);
        }
示例#4
0
 private bool IsCarInLot(string token)
 {
     return(OccupiedLots.ContainsKey(token));
 }