Пример #1
0
        async Task <VehicleSummaryModels> getModelsYears(string make, string model)
        {
            var response = await API_VEHICLE_TYPE_BASE_URL
                           .AppendPathSegments("makes", make, "models", model, "years")
                           .SetQueryParam("api-version", "v1")
                           .WithHeader(API_VEHICLE_TYPE_HEADER_OCP_APIM_SUBS_KEY, API_VEHICLE_TYPE_HEADER_OCP_APIM_SUBS_VALUE)
                           .GetJsonAsync <List <string> >();

            VehicleSummaryModels vsm = new VehicleSummaryModels();

            vsm.Name  = model;
            vsm.Years = response;
            return(vsm);
        }
Пример #2
0
        public async Task <VehicleSummaryResponse> GetSummaryByMake(string make)
        {
            VehicleSummaryResponse response = new VehicleSummaryResponse();

            response.Models = new List <VehicleSummaryModels>();
            response.Make   = make;
            List <string> models = await getModels(make);

            foreach (string model in models)
            {
                VehicleSummaryModels vsm = await getModelsYears(make, model);

                response.Models.Add(vsm);
            }
            return(response);
        }