コード例 #1
0
        public Car TakeCar(Ticket ticket)
        {
            if (ticket.IsValidTicket(this))
            {
                var car = ParkingCars.Find(
                    parkingCar => parkingCar.PlateNumber.Equals(ticket.PlateNumber));
                ParkingCars.Remove(car);

                return(car);
            }

            throw new Exception("Invalid ticket.");
        }
コード例 #2
0
        public Ticket ReceiveCar(Car car)
        {
            ParkingCars.Add(car);

            return(new Ticket(Address, car.PlateNumber));
        }