예제 #1
0
        public static void AddNewListVehicle()
        {
            Vehicle vehicle = new Vehicle();

            ManagmentApp.ShowMessage("Enter Id");

            vehicle.Id = InputVerificationID.EnterIdVehicle();

            while (ShowVehicle.Vehicles.Exists(veh => veh.Id == vehicle.Id))
            {
                ManagmentApp.ShowMessage("Enter new ID");
                vehicle.Id = InputVerificationID.EnterIdVehicle();
            }

            ChoiseTypeAndBrand.TypeOfVehicles(vehicle);
            ShowVehicle.InformationVehicle(vehicle);

            ShowVehicle.Vehicles.Add(new Vehicle(vehicle.Id, vehicle.BrandVehicle, vehicle.TypeVehicle, vehicle.RentalPrice));
            EventLogWorking.message = $"Add new vehicle. Vehicle ID: {vehicle.Id}, " +
                                      $"brand vehicle: { vehicle.BrandVehicle}, " +
                                      $"renta price for vehicle: { vehicle.RentalPrice}$ per 10 minutes";
            vehicle.WriteToEventLog += EventLogWorking.InformationEventLog;
            vehicle.ShowMessage     += ShowVehicle.WriteToFile;
            vehicle.Message();
        }
        public static void ChoosingCarForRent()
        {
            ManagmentApp.ShowMessage("\nEnter ID vehicle do you want rent:");
            int Id      = InputVerificationID.NoVehiclesWithId();
            var vehicle = ShowVehicle.Vehicles.SingleOrDefault(r => r.Id == Id);

            ManagmentApp.ShowErrorMsg($"Your vehicle that you rented.");

            ShowVehicle.Vehicles.Remove(vehicle);

            ShowVehicle.InformationVehicle(vehicle);
            EventLogWorking.message  = $" You rented {vehicle.TypeVehicle}, brand: {vehicle.BrandVehicle}, price {vehicle.RentalPrice}$ per 10 minutes.";
            vehicle.WriteToEventLog += EventLogWorking.InformationEventLog;
            vehicle.Message();
        }