Forked from pageaffairs/gist:91f2a6f31dec4e9af8c949d690bab7b2
Created
February 4, 2021 07:48
-
-
Save SitePointEditors/7720092b02cbe5203c29e04207708715 to your computer and use it in GitHub Desktop.
ASP.NET application snippet: 4
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 class MyApiController : ApiController | |
{ | |
// Top-level method | |
public ActionResult HandleRESTApiCall(){ | |
SomeType someObj = DoSomethingAsync().Result; | |
return OkResult(someObj); | |
} | |
private async Task<SomeType> DoSomethingAsync(){ | |
var someData = await GetDataAsync(); | |
return new SomeType(someData); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment