Modeling and control of discrete-time and sampled-data port-Hamiltonian systems