public ActionResult Update(int id) { CreateFaq ViewModel = new CreateFaq(); string url = "FaqData/FindFaq/" + id; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { FaqDto selectedFaq = response.Content.ReadAsAsync <FaqDto>().Result; ViewModel.faq = selectedFaq; url = "CategoryData/ListCategories"; response = client.GetAsync(url).Result; IEnumerable <CategoryDto> PotentialCategories = response.Content.ReadAsAsync <IEnumerable <CategoryDto> >().Result; ViewModel.allCategories = PotentialCategories; return(View(ViewModel)); } else { return(RedirectToAction("Error")); } }
public ActionResult Create() { CreateFaq ViewModel = new CreateFaq(); string url = "CategoryData/ListCategories"; HttpResponseMessage response = client.GetAsync(url).Result; IEnumerable <CategoryDto> PotentialCategory = response.Content.ReadAsAsync <IEnumerable <CategoryDto> >().Result; ViewModel.allCategories = PotentialCategory; return(View(ViewModel)); }