Start Async function

Asked

Viewed 61 times

1

Good morning guys, I don’t have much knowledge about async, and maybe someone could help me with this:

public async Task<ActionResult> IndexAsync(CancellationToken cancellationToken)
    {
        var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()).
            AuthorizeAsync(cancellationToken);

        if (result.Credential != null)
        {
            ViewBag.Message = result.Credential.UserId;
            DriveService service = new DriveService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = result.Credential,
                ApplicationName = "Drive API",
            });
            return View();
        }
        else
        {
            return new RedirectResult(result.RedirectUri);
        }
    }

I needed a way to call this job, only I don’t know how I’d do it, if anyone could help me. Note: It is inside a controller.

  • This is an action, who will call it will be a view. If you are trying to call it manually, it is not a good idea.

  • https://msdn.microsoft.com/pt-br/library/ee728598(v=vs.100). aspx

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.