示例#1
0
        public void Execute(IDBAccess <Vehicle> database)
        {
            database = (InMemoryDB)database;
            // list all vehicles
            Console.WriteLine("\nAll Cars:\n");
            PrintCars(database.GET().Where(x => x.Type == VehicleType.CAR).Cast <Car>());
            PrintTrucks(database.GET().Where(x => x.Type == VehicleType.TRUCK).Cast <Truck>());

            Console.WriteLine("\nAll Trucks:\n\n");
        }
示例#2
0
        public void Execute(IDBAccess <Vehicle> database)
        {
            int     num = InputHelper.GetValidIntegerInput("Enter ID of vehicle to delete: ");
            Vehicle v   = database.GET(num);

            InputHelper.GetValidConfirmationInput($"Vehicle: {v.LicensePlate}, [{v.YearBuilt}]\nAre you sure you want to remove vehicle {v.VehicleId}? (y/n): ");
            database.DELETE(num);
        }
 private void UpdatePrices(IDBAccess <Vehicle> database, int percentage)
 {
     foreach (var vehicle in database.GET())
     {
         vehicle.PriceStrategy = new InflatedPriceStrategy(percentage);
         database.PUT(vehicle);
     }
 }
        public void Execute(IDBAccess <Vehicle> database)
        {
            //display impportant info
            Console.WriteLine("Company Overview:");

            IEnumerable <Vehicle> cars = database.GET();

            PrintVehicleCount(cars);
            PrintCarCount(cars);
            PrintTruckCount(cars);
            PrintTotalValue(cars);
        }