public async Task <nautaResponse> Recargar() { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://smsteleyuma.azurewebsites.net/Service1.svc/TransferTo/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); _Global.RecargaNauta.simulation = "0"; try { var response = await client.PostAsync("nauta", _Global.RecargaNauta.AsJsonStringContent()); var Result = await response.Content.ReadAsStringAsync(); var nautaResponse = JsonConvert.DeserializeObject <nautaResponse>(Result); return(nautaResponse); } catch (Exception) { var nautaResponse = new nautaResponse(); nautaResponse.erroe_code = "-1"; nautaResponse.error_message = "Error de conección"; return(nautaResponse); } } }
public async Task <nautaResponse> Simular(string usuario, int product, int monto) { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://smsteleyuma.azurewebsites.net/Service1.svc/TransferTo/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var nauta = new nautaInfo { account_number = usuario, product_id = product, monto = monto, external_id = Convert.ToInt32(_Global.CodigoVerificacion), simulation = "1", recipient_sms_notification = "1", sender_sms_notification = true, sender = new nautaUser { last_name = _Global.CurrentAccount.lastname, middle_name = "", first_name = _Global.CurrentAccount.firstname, email = _Global.CurrentAccount.email, mobile = 13050000000 }, recipient = new nautaUser { last_name = "Arias", middle_name = "", first_name = "Royber", email = "*****@*****.**", mobile = 5355043317 } }; _Global.RecargaNauta = nauta; try { var response = await client.PostAsync("nauta", nauta.AsJsonStringContent()); var Result = await response.Content.ReadAsStringAsync(); var nautaResponse = JsonConvert.DeserializeObject <nautaResponse>(Result); return(nautaResponse); } catch (Exception) { var nautaResponse = new nautaResponse(); nautaResponse.erroe_code = "-1"; nautaResponse.error_message = "Error de conección"; return(nautaResponse); } } }