示例#1
0
        public string inserUser()
        {
            itemUsuario codigo = new itemUsuario
            {
                user = ""
            };
            string              json       = JsonConvert.SerializeObject(codigo, Formatting.Indented);
            StringContent       Content    = new StringContent(json, Encoding.UTF8, "application/json");
            Uri                 RequestUri = new Uri("https://usuarioapp.herokuapp.com/codigo");
            HttpResponseMessage res        = client.PutAsync(RequestUri, Content).Result;
            string              result     = JsonConvert.SerializeObject(res.Content.ReadAsStringAsync().Result, Formatting.Indented);
            var                 find       = JsonConvert.DeserializeObject <itemUsuario>(res.Content.ReadAsStringAsync().Result);

            return(find.user);
        }
示例#2
0
        public List <orden> getOrden(string usuario)
        {
            itemUsuario codigo = new itemUsuario
            {
                idUsuario = usuario
            };
            string              json       = JsonConvert.SerializeObject(codigo, Formatting.Indented);
            StringContent       Content    = new StringContent(json, Encoding.UTF8, "application/json");
            Uri                 RequestUri = new Uri("https://ordenesrealizadas.herokuapp.com/ordenes");
            HttpResponseMessage res        = client.PutAsync(RequestUri, Content).Result;
            string              result     = JsonConvert.SerializeObject(res.Content.ReadAsStringAsync().Result, Formatting.Indented);

            if (result.Contains("exists"))
            {
                //result = "contiene";
                find = null;
            }
            else
            {
                //result = "no contiene";
                find = JsonConvert.DeserializeObject <List <orden> >(res.Content.ReadAsStringAsync().Result);
            }
            return(find);
        }