public async Task <ResultTransaccion> SaveTransaccion(RegistrarTransaccion transaccion) { ResultTransaccion Items = new ResultTransaccion(); string url = "https://" + PATHSERVER + "/OR/Transaccion/SaveTransaccion"; try { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11; WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials; client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var json = JsonConvert.SerializeObject(transaccion); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(url, content); if (response.IsSuccessStatusCode) { var content2 = await response.Content.ReadAsStringAsync(); Items = JsonConvert.DeserializeObject <ResultTransaccion>(content2); } } catch (Exception ex) { //Debug.WriteLine(@" ERROR {0}", ex.Message); } return(Items); }
public async Task <IActionResult> SaveTransaccion([FromBody] RegistrarTransaccion transaccion) { var result = await Task.Run(() => context.SaveTransaccion(transaccion)); //if (!result.Result) // return NotFound("Transaccion No Save"); return(Ok(result)); }