public TurmaDocente VincularDocente(TurmaDocente entidade) { TurmaDocente docente = _TurmaRepository.VincularDocente(entidade); docente.Docente = _docenteRepository.PesquisarPorId(docente.DocenteId); return(docente); }
public void ExcluirVinculoDocente(int id) { if (id == 0) { throw new MensagemException(EnumStatusCode.RequisicaoInvalida, "Não foi possivel excluir o vinculo com o docente."); } TurmaDocente cd = _TurmaRepository.PesquisarVinculoDocente(id); cd.Turma = null; cd.Docente = null; if (cd == null || cd.Id == 0) { throw new MensagemException(EnumStatusCode.RequisicaoInvalida, "Não foi possivel excluir o vinculo com o docente. Vinculo não localizado"); } _TurmaRepository.ExcluirVinculoDocente(cd); }
public IActionResult VincularDocente(TurmaDocente entidade) { return(Ok(_servico.VincularDocente(entidade))); }
public TurmaDocente VincularDocente(TurmaDocente entidade) { _dbContexto.Set <TurmaDocente>().Add(entidade); _dbContexto.SaveChanges(); return(entidade); }
public void ExcluirVinculoDocente(TurmaDocente cd) { base._dbContexto.Remove(cd); base._dbContexto.SaveChanges(); }