public ActionResult Index(UrlModell url) { if (ModelState.IsValid) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(_ApiUrl); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string result = client.PostAsync("/short", url.LongURL, new JsonMediaTypeFormatter()) .Result .Content .ReadAsAsync <string>() .Result; url.ShortURL = result; //ViewData["ShortURL"] = result; return(View(url)); } //return View(); } return(View()); }
public ActionResult Index() { UrlModell url = new UrlModell(); return(View(url)); }