예제 #1
0
        public async Task <ActionResult> GetBoleto(IdG boletoRequest)
        {
            BoletoVIewModel boletosModel = new BoletoVIewModel();
            string          url          = urlMain + $"boletos/{boletoRequest.IdGuid}";
            var             httpClient   = new HttpClient();
            var             response     = await httpClient.GetAsync(url).ConfigureAwait(false);

            var boleto = response.Content.ReadAsStringAsync().Result;

            boletosModel = JsonConvert.DeserializeObject <BoletoVIewModel>(boleto);

            return(Json(boletosModel));
        }
예제 #2
0
        public async Task <ActionResult> Create(BoletoVIewModel boletoRequest)
        {
            Dictionary <string, string> BugData = new Dictionary <string, string>
            {
                { "IdViaje", boletoRequest.IdViaje.ToString() },
                { "IdViajero", boletoRequest.IdViajero.ToString() }
            };
            string url        = urlMain + "boletos";
            var    httpClient = new HttpClient();
            var    jsonData   = JsonConvert.SerializeObject(BugData, Formatting.Indented);
            var    content    = new StringContent(jsonData, Encoding.UTF8, "application/json");
            var    response   = await httpClient.PostAsync(url, content).ConfigureAwait(false);

            return(Json(response));
        }