Helm-model and shell-model studies of the photoproduction of charged pions in 12C