コード例 #1
0
        private void AgregarDepto()
        {
            Departamento depto = new Departamento
            {
                direccion         = txtDireccion.Text,
                zona              = cbZona.Text,
                banos             = int.Parse(txtBanos.Text),
                dormitorios       = int.Parse(txtDorm.Text),
                estado_mantencion = true,
                precio            = int.Parse(txtPrecio.Text),
                metros_cuadrados  = int.Parse(txtMetros.Text)
            };
            string  json      = JsonConvert.SerializeObject(depto);
            dynamic respuesta = _apiPost.Agregar("http://192.168.100.50/api/departamentos_mantencion/", json);

            MessageBox.Show($"Departamento {depto.direccion} agregado correctamente", "¡Éxito!");
        }
コード例 #2
0
        private void AgregarFunc()
        {
            Funcionario func = new Funcionario
            {
                first_name = txtNombre.Text,
                last_name  = txtApellido.Text,
                is_active  = true,
                is_staff   = true,
                telefono   = int.Parse(txtFono.Text),
                edad       = int.Parse(txtEdad.Text),
                username   = txtEmp.Text,
                email      = txtCorreo.Text,
                password   = txtCont.Text
            };
            string  json      = JsonConvert.SerializeObject(func);
            dynamic respuesta = _apiPost.Agregar("http://192.168.100.50/api/usuarios/", json);

            MessageBox.Show($"Usuario {func.first_name + " " + func.last_name} agregado correctamente", "¡Éxito!");
        }