Created
February 4, 2021 00:03
-
-
Save pageaffairs/91f2a6f31dec4e9af8c949d690bab7b2 to your computer and use it in GitHub Desktop.
ASP.NET application snippet: 4
This file contains 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