public async Task <IActionResult> Cars() { var response = await httpClient.GetAsync(pathBuilder.GetCarServiceUrl() + "more/?skipCount=0"); var result = await response.Content.ReadAsAsync <LoadCollection <Car> >(); return(View(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()); }
public async Task <IActionResult> Favorites() { var carsIds = HttpContext.Session.Get <List <int> >(User.Identity.Name + "-favorites"); var path = pathBuilder.GetCarServiceUrl() + "fromFavorites"; var response = await httpClient.PostAsJsonAsync(path, carsIds); if (response.IsSuccessStatusCode) { var result = await response.Content.ReadAsAsync <List <Car> >(); if (result == null) { result = new List <Car>(); } return(View(result)); } else { return(View(new List <Car>())); } }