static void Main(string[] args)
        {
            string entity = null;
            IControl control = null;

            //GenerateTestCarRental();

            Console.WriteLine(
                "Enter 'manager' or 'client' to enter in Car Rental system. " +
                "Or enter 'generate' to generate initial data.");

            entity = Console.ReadLine();

            switch (entity.ToLower())
            {
                case ("manager"):
                    control = new Manager();
                    Console.WriteLine("Manager control:");
                    control.Control();
                    break;
                case ("client"):
                    Console.Write("Enter your ID, please:");
                    control = new Client(Console.ReadLine());
                    control.Control();
                    break;
                case ("generate"):
                    GenerateTestCarRental();
                    break;
                default:
                    Console.WriteLine("Is not recognized as an internal command.");
                    Console.ReadKey();
                    break;
            }
        }
 public void AddClient(Client client)
 {
     if (this.IdClientIsOK(client.Id))
     {
         _clientRepository.Save(client);
         Console.WriteLine("The client was added.");
     }
     else
     {
         Console.WriteLine("This ID ({0}) is used.", client.Id);
     }
 }
        static void GenerateTestCarRental()
        {
            CarRentalSystem carRental = new CarRentalSystem();

            Client clien1 = new Client("111", "Mr.Jonson");
            Client clien2 = new Client("222", "Mr.Anderson");
            Client clien3 = new Client("333", "Mr.Pietersen");

            carRental.AddClient(clien1);
            carRental.AddClient(clien2);
            carRental.AddClient(clien3);

            Car car1 = new Car("1111", "Mercedes-Benz");
            Car car2 = new Car("2222", "BMW");
            Car car3 = new Car("3333", "Audi");
            Car car4 = new Car("4444", "Ferrari");

            carRental.AddCar(car1);
            carRental.AddCar(car2);
            carRental.AddCar(car3);
            carRental.AddCar(car4);
        }
        public void GetCar(string clientId, string carId)
        {
            selectedClient = this.SelectClient(clientId);
            selectedCar =  this.SelectCar(carId);

            this.ResetCarStatus();
            if (selectedCar != null & selectedClient != null)
            {
                if (this.CarIsFree(selectedCar))
                {
                    selectedCar.Client = selectedClient.Id;
                    selectedCar.DateOfLease = DateTime.Now.ToString();
                    _carRepository.Save(selectedCar);
                    Console.WriteLine(selectedCar.ToString());
                }
                else
                {
                    Console.WriteLine("This car is used.");
                }
            }

            ResetSelected();
        }
 private void ResetSelected()
 {
     selectedCar = null;
     selectedClient = null;
 }