Created
October 15, 2013 08:18
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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