Beyond mean-field study of elastic and inelastic electron scattering off nuclei