示例#1
0
        public async Task <IActionResult> Add()
        {
            var response = await httpClient.GetAsync(pathBuilder.GetCarServiceUrl() + "specification");

            var result = await response.Content.ReadAsAsync <CarSpecifications>();

            response = await httpClient.GetAsync(pathBuilder.GetCarServiceUrl() + "models");

            var models = await response.Content.ReadAsAsync <List <Model> >();

            response = await httpClient.GetAsync(pathBuilder.GetCitiesServiceUrl());

            var cities = await response.Content.ReadAsAsync <List <City> >();

            ViewBag.Cities = cities;
            ViewBag.Models = models;
            return(View(new CarViewModel {
                CarSpecifications = result
            }));
        }
        new public async Task <IActionResult> Request()
        {
            var response = await httpClient.GetAsync(pathBuilder.GetCarServiceUrl() + "models");

            var models = await response.Content.ReadAsAsync <List <Model> >();

            response = await httpClient.GetAsync(pathBuilder.GetCitiesServiceUrl());

            var cities = await response.Content.ReadAsAsync <List <City> >();

            ViewBag.Cities = cities;
            ViewBag.Models = models;
            return(View());
        }