Generalized diffraction model for one- and two-nucleon transfer reactions