Skip to content

Instantly share code, notes, and snippets.

@dariuszparys
Created October 15, 2013 08:18
Show Gist options
  • Save dariuszparys/6988264 to your computer and use it in GitHub Desktop.
Save dariuszparys/6988264 to your computer and use it in GitHub Desktop.
Demo Snippet from Visual Studio Evolution 2013 Talk jQuery Mobile with ASP.NET MVC Controller Action to retrieve JSON Data and feed the view with it
public async Task<ActionResult> Index()
{
HttpClient client = new HttpClient();
var result = await client.GetAsync("http://vsevolution.azurewebsites.net/api/agenda/getsessions");
// In demos I give a fuck about error handling
result.EnsureSuccessStatusCode();
var response = await result.Content.ReadAsAsync<Session[]>();
return View(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment