public void Update(Vehicle vehicle, DateTime now, decimal pricePerMinute) { TotalVehicles += 1; TotalMembers += 1; TotalWheels += vehicle.NumberOfWheels; TotalCost += (decimal)Math.Round((now - vehicle.CheckinTime).TotalMinutes) * pricePerMinute; TotalUnitsUsed += vehicle.Units; if (!ColorNames.ContainsKey(vehicle.VehicleColorId)) { ColorNames[vehicle.VehicleColorId] = vehicle.Color.Name; } if (!TypeNames.ContainsKey(vehicle.VehicleTypeId)) { TypeNames[vehicle.VehicleTypeId] = vehicle.Type.Type; } // Vehicle Color statistics if (!ColorStatistics.ContainsKey(vehicle.VehicleColorId)) { ColorStatistics[vehicle.VehicleColorId] = 1; } else { ColorStatistics[vehicle.VehicleColorId] += 1; } // Vehicle Type statistics if (!TypeStatistics.ContainsKey(vehicle.VehicleTypeId)) { TypeStatistics[vehicle.VehicleTypeId] = 1; } else { TypeStatistics[vehicle.VehicleTypeId] += 1; } // Vehicle Type & Color statistics if (!TypeColorStatistics.ContainsKey(vehicle.VehicleTypeId)) { TypeColorStatistics[vehicle.VehicleTypeId] = new Dictionary <int, int>(); } var tcs = TypeColorStatistics[vehicle.VehicleTypeId]; if (!tcs.ContainsKey(vehicle.VehicleColorId)) { tcs[vehicle.VehicleColorId] = 1; } else { tcs[vehicle.VehicleColorId] += 1; } }