Exemplo n.º 1
0
 private void consumeUsuarios()
 {
     so = new consumiendo()
     {
         nombre   = txt_nombre.Text,
         apellido = txt_apellido.Text,
         saldo    = txt_saldo.Text,
         fecha    = DateTime.Today,
         cuenta   = txt_cuenta.Text,
         clave    = "",
         rol      = txt_rol.Text,
         cedula   = txt_cedula.Text
     };
 }
Exemplo n.º 2
0
 private void consumeUsuarios(int id, string nombre, string apellido, string saldo, DateTime fecha, string cuenta, string clave, string rol, string cedula)
 {
     so = new consumiendo()
     {
         id       = id,
         nombre   = nombre,
         apellido = apellido,
         saldo    = saldo,
         fecha    = System.Convert.ToDateTime(fecha),
         cuenta   = cuenta,
         clave    = clave,
         rol      = rol,
         cedula   = cedula
     };
 }
Exemplo n.º 3
0
        public static string GetPost(string url, consumiendo so)
        {
            string     result     = "";
            WebRequest webRequest = WebRequest.Create(url);

            webRequest.Method      = "put";
            webRequest.ContentType = "application/json;charset=UTF-8";
            using (var osw = new StreamWriter(webRequest.GetRequestStream()))
            {
                string json = JsonConvert.SerializeObject(so, Formatting.Indented);
                //string json = "{\"nombre\":\"juanito\"}";
                osw.Write(json);
                osw.Flush();
                osw.Close();
            }
            WebResponse oresponse = webRequest.GetResponse();

            using (var osr = new StreamReader(oresponse.GetResponseStream()))
            {
                result = osr.ReadToEnd().Trim();
            }

            return(result);
        }