public Task <HttpResponseMessage> ExcluirCompra([FromBody] JObject jObject) { var codigoCompra = jObject["codigoCompra"].ToObject <int>(); HttpResponseMessage response; try { _compraService.ExcluirCompra(codigoCompra); response = ReturnSuccess(); } catch (Exception ex) { response = ReturnError(ex); } var tsc = new TaskCompletionSource <HttpResponseMessage>(); tsc.SetResult(response); return(tsc.Task); }