예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem != null)
     {
         RentService.AddNewRent(new RentClass(client, (CarClass)listBox1.SelectedItem));
         MessageBox.Show($"Car with id {((CarClass)listBox1.SelectedItem).CarId} was successfully rented", "Autopark");
         this.Close();
     }
 }
예제 #2
0
        private static void RentCar(ClientClass client)
        {
            Console.Clear();
            //AutoParkService.PrintAvailableCars();
            CarClass chosenCar = AutoParkService.ChooseCar();

            Console.Clear();
            if (chosenCar != null)
            {
                RentService.AddNewRent(new RentClass(client, chosenCar));
                Console.WriteLine("Car with id '{0}' was successfully rented.", chosenCar.CarId);
            }
            else
            {
                Console.WriteLine("Id not found!");
            }
        }