On the properties of elliptical and spiral galaxies in a CDM scenario