private void ModificarDepto() { 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) }; if (rbDisp.Checked) { depto.estado_mantencion = false; MostrarDepto(false); } else { MostrarDepto(true); } string json = JsonConvert.SerializeObject(depto); dynamic respuesta = _apiPut.Modificar($"http://192.168.100.50/api/departamentos_mantencion/{txtBuscar.Text}/", json); MessageBox.Show($"Departamento {depto.direccion} modificado correctamente", "¡Éxito!"); }
private async void ModificarFunc() { 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, }; if (rbInactivo.Checked) { func.is_active = false; } var response = await RestHelper.BuscarFuncionario(txtBuscar.Text); var datos = JsonConvert.DeserializeObject <Funcionario>(response); if (func.password == "") { MessageBox.Show($"Para modificar el usuario se necesita cambiar la contraseña", "¡Error!"); } else { string json = JsonConvert.SerializeObject(func); dynamic respuesta = _apiPut.Modificar($"http://192.168.100.50/api/usuarios/{txtBuscar.Text}/", json); MessageBox.Show($"Usuario {func.first_name + " " + func.last_name} modificado correctamente", "¡Éxito!"); MostrarFunc(true); } }