We present a quantum electrodynamical model involving nitrogen-vacancy centers coupled to a whispering-gallery mode cavity. Two schemes are considered to create W state and Bell state, respectively. One of the schemes makes use of the Raman transition with the cavity field virtually excited; The other enables the Bell state preparation and quantum information transfer by virtue of dark state evolution and adiabatic passage, which is tolerant to ambient noise and experimental parameter fluctuations. We justify our schemes by considering the experimental feasibility and challenge using currently available technology.