Skip to content

Instantly share code, notes, and snippets.

@MerrittMelker
Created August 2, 2015 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MerrittMelker/84d824a33d60288bcc07 to your computer and use it in GitHub Desktop.
Save MerrittMelker/84d824a33d60288bcc07 to your computer and use it in GitHub Desktop.
public ActionResult Sync1()
{
using (var soapClient = MySoapClient())
{
var task = soapClient.Method1Async().ConfigureAwait(false);
ViewBag.Result = task.GetAwaiter().GetResult();
}
return View();
}
// Or
public ActionResult Sync2()
{
using (var soapClient = MySoapClient())
{
ViewBag.Result = CallMethod1Async().Result();
}
return View();
}
public async Task<bool> CallMethod1Async()
{
using (var soapClient = MySoapClient())
{
return await soapClient.Method1Async().ConfigureAwait(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment