public static AppraisalViewFormModel GetVehicleInfoFromChromeDecode(VehicleDescription vehicleInfo) { if (vehicleInfo == null) { return(null); } var appraisal = new AppraisalViewFormModel { VinDecodeSuccess = true, AppraisalDate = DateTime.Now.ToShortDateString(), VinNumber = vehicleInfo.vinDescription != null ? vehicleInfo.vinDescription.vin : string.Empty, AppraisalModel = vehicleInfo.bestModelName, Make = vehicleInfo.bestMakeName, Trim = vehicleInfo.bestTrimName, SelectedModel = vehicleInfo.bestModelName, //TODO: get Chrom Model ID ModelYear = vehicleInfo.modelYear.ToString(), ExteriorColorList = SelectListHelper.InitalExteriorColorList(vehicleInfo.exteriorColor), InteriorColorList = SelectListHelper.InitalInteriorColorList(vehicleInfo.interiorColor) }; if (vehicleInfo.style != null && vehicleInfo.style.Any()) { Style firstStyle = vehicleInfo.style.FirstOrDefault(); if (firstStyle != null) { appraisal.Door = firstStyle.passDoors.ToString(); appraisal.MSRP = firstStyle.basePrice.msrp.ToString("C"); appraisal.DriveTrainList = SelectListHelper.InitalDriveTrainList(firstStyle.drivetrain.ToString()); bool existed; appraisal.TrimList = SelectListHelper.InitalTrimList(appraisal, firstStyle.trim, vehicleInfo.style, firstStyle.id, out existed); if (firstStyle.stockImage != null) { appraisal.DefaultImageUrl = firstStyle.stockImage.url; } } } var chromeAutoService = new ChromeAutoService(); List <ExtendedFactoryOptions> listPackageOptions = chromeAutoService.GetPackageOptions(vehicleInfo); List <ExtendedFactoryOptions> listNonInstalledOptions = chromeAutoService.GetNonInstalledOptions(vehicleInfo); var builder = new StringBuilder(); if (vehicleInfo.standard != null && vehicleInfo.standard.Any()) { foreach (Standard fo in vehicleInfo.standard) { builder.Append(fo.description + ","); } if (!String.IsNullOrEmpty(builder.ToString())) { builder.Remove(builder.Length - 1, 1); } appraisal.StandardInstalledOption = builder.ToString(); } appraisal.FactoryPackageOptions = SelectListHelper.InitalFactoryPackagesOrOption(listPackageOptions); appraisal.FactoryNonInstalledOptions = SelectListHelper.InitalFactoryPackagesOrOption(listNonInstalledOptions); if (vehicleInfo.vinDescription != null && !String.IsNullOrEmpty(vehicleInfo.vinDescription.bodyType)) { appraisal.BodyTypeList = SelectListHelper.InitialBodyTypeList(vehicleInfo.vinDescription.bodyType); } else { StyleBodyType[] bodyType = vehicleInfo.style.Last().bodyType; appraisal.BodyTypeList = SelectListHelper.InitialBodyTypeList(vehicleInfo.style != null ? (bodyType != null ? bodyType.Last().Value : vehicleInfo.bestStyleName) : vehicleInfo.bestStyleName); if (appraisal.CylinderList == null) { appraisal.CylinderList = new BindingList <SelectListItem>(); } if (appraisal.LitersList == null) { appraisal.LitersList = new BindingList <SelectListItem>(); } if (appraisal.FuelList == null) { appraisal.FuelList = new BindingList <SelectListItem>(); } } if (vehicleInfo.engine != null) { appraisal.FuelList = SelectListHelper.InitialFuelList(vehicleInfo.engine); appraisal.CylinderList = SelectListHelper.InitialCylinderList(vehicleInfo.engine); appraisal.LitersList = SelectListHelper.InitialLitterList(vehicleInfo.engine); Engine firstEngine = vehicleInfo.engine.FirstOrDefault(); if (firstEngine != null && firstEngine.fuelEconomy != null) { appraisal.FuelEconomyCity = firstEngine.fuelEconomy.city.low.ToString(); appraisal.FuelEconomyHighWay = firstEngine.fuelEconomy.hwy.low.ToString(); } } if (vehicleInfo.vinDescription != null && vehicleInfo.vinDescription.marketClass != null) { if ( vehicleInfo.vinDescription.marketClass.Any( tmp => tmp.Value.Contains("Truck") || tmp.Value.Contains("Cargo Vans"))) { appraisal.IsTruck = true; } } return(appraisal); }