Access to Asynchronous Webservice

0

I'm working on a project, where I run an asynchronous webservice (project pattern), but I'm having a problem because webservice has not yet finished execution and my processing continues (causing errors).

Is there any way I can do to just continue processing after I finish running the webservice?

Follows a part of the code where I make the webservice call (record history) after a change. I need the process to continue (redirect) only after the entire webservice has run (I can not change the webservice):

public ActionResult EditarConfirmed(EditarAnotacoesAdministrativasViewModel viewModel, long? handlePeg, long id)
        {
            if (ModelState.IsValid)
            {
                viewModel.Entidade.Handle = id;
                repositorio.Altera(viewModel.Entidade);

                var proxy = new AnotacoesAdmPegServiceClient();
                var handleAnotacao = new anotacaoAdministrativaId() { codigo = viewModel.Entidade.Handle };

                proxy.gravarHistorico(2, handleAnotacao);

                return RedirectToAction("Index", new { Id = viewModel.Entidade.Handle });
            }
            else
            {
                return View(viewModel);
            }
        }
    
asked by anonymous 02.09.2016 / 00:32

0 answers