public async Task<ActionResult> Index(HomeViewModel model) { var client = new HttpClient(); var parameters = new NameValueCollection { {"reviewText", model.Keyword}, {"minAppearance", model.MinAppearance.ToString()}, {"minAroma", model.MinAroma.ToString()}, {"minPalate", model.MinPalate.ToString()}, {"minTaste", model.MinTaste.ToString()}, {"minOverall", model.MinOverall.ToString()} }; var uriBuilder = new UriBuilder { Scheme = "http", Host = ConfigurationManager.AppSettings["APIHost"], Port = 8080, Path = "/api/Beer/", Query = ToQueryString(parameters) }; HttpResponseMessage response = await client.GetAsync(uriBuilder.Uri); response.EnsureSuccessStatusCode(); var recommendations = await response.Content.ReadAsAsync<IEnumerable<BeerRecommendation>>(); model.BeerRecommendations = recommendations; return View(model); }
public ActionResult Index() { var model = new HomeViewModel(); return View(model); }