MazdaApiLib/MazdaApiVehicle.cs
/// <summary>
/// Get the list of vehicles from the API asynchronously.
/// </summary>
/// <returns>A list of VehicleModel describing the raw information for all api vehicles</returns>
Get the list of vehicles from the API asynchronously.
Get the list of vehicles from the API asynchronously .
public async Task<List<VehicleModel>> GetVehiclesAsync()
        {
            List<VehicleModel> retval = new List<VehicleModel>();
            MazdaApiVehicles vehicles = await GetRawVehiclesAsync();
            for (int i = 0; i < vehicles.VecBaseInfos.Count; i++)
            {
                MazdaApiRawVehicleBaseInfo baseInfo = vehicles.VecBaseInfos[i];
                MazdaApiVehicleOtherInformation otherInformation = baseInfo.Vehicle.VehicleInformation.OtherInformation;
                if (vehicles.VehicleFlags[i].VinRegistStatus == 1 || vehicles.VehicleFlags[i].VinRegistStatus == 3)
                    retval.Add(new VehicleModel
                    {
                        Vin = baseInfo.Vin,
                        Id = baseInfo.Vehicle.CvInformation.InternalVin,
                        IsEvVehicle = (baseInfo.VehicleType ?? string.Empty) == "1" && (baseInfo.EconnectType ?? string.Empty) == "1",
                        VinRegistStatus = vehicles.VehicleFlags[i].VinRegistStatus,
                        Nickname = await _controller.GetNicknameAsync(baseInfo.Vin),
                        CarlineCode = otherInformation.CarlineCode,
                        CarlineName = otherInformation.CarlineName,
                        ModelYear = otherInformation.ModelYear,
                        ModelCode = otherInformation.ModelCode,
                        ModelName = otherInformation.ModelName,
                        AutomaticTransmission = otherInformation.TransmissionType == "A",
                        InteriorColorCode = otherInformation.InteriorColorCode,
                        InteriorColorName = otherInformation.InteriorColorName,
                        ExteriorColorCode = otherInformation.ExteriorColorCode,
                        ExteriorColorName = otherInformation.ExteriorColorName
                    });
            }
            return retval;
        }
public async Task < List < VehicleModel > > GetVehiclesAsync ( ) { List < VehicleModel > retval = new List < VehicleModel > ( ) ; MazdaApiVehicles vehicles = await GetRawVehiclesAsync ( ) ; for ( int i = 0 ; i < vehicles . VecBaseInfos . Count ; i ++ ) { MazdaApiRawVehicleBaseInfo baseInfo = vehicles . VecBaseInfos [ i ] ; MazdaApiVehicleOtherInformation otherInformation = baseInfo . Vehicle . VehicleInformation . OtherInformation ; if ( vehicles . VehicleFlags [ i ] . VinRegistStatus == 1 || vehicles . VehicleFlags [ i ] . VinRegistStatus == 3 ) retval . Add ( new VehicleModel { Vin = baseInfo . Vin , Id = baseInfo . Vehicle . CvInformation . InternalVin , IsEvVehicle = ( baseInfo . VehicleType ?? string . Empty ) == " " && ( baseInfo . EconnectType ?? string . Empty ) == " " , VinRegistStatus = vehicles . VehicleFlags [ i ] . VinRegistStatus , Nickname = await _controller . GetNicknameAsync ( baseInfo . Vin ) , CarlineCode = otherInformation . CarlineCode , CarlineName = otherInformation . CarlineName , ModelYear = otherInformation . ModelYear , ModelCode = otherInformation . ModelCode , ModelName = otherInformation . ModelName , AutomaticTransmission = otherInformation . TransmissionType == " " , InteriorColorCode = otherInformation . InteriorColorCode , InteriorColorName = otherInformation . InteriorColorName , ExteriorColorCode = otherInformation . ExteriorColorCode , ExteriorColorName = otherInformation . ExteriorColorName } ) ; } return retval ; }
Get the list of vehicles from the API asynchronously.
Get the list of vehicles from the API asynchronously .
A list of VehicleModel describing the raw information for all api vehicles
A list of VehicleModel describing the raw information for all api vehicles