A unified framework for projecting both Slater determinant and BCS states