コード例 #1
0
 public IActionResult Delete(Guid Id)
 {
     try
     {
         _ProfessorTurmaRepository.Remover(Id);
         return(Ok(Id));
     }
     catch (Exception ex)
     {
         //Caso ocorra um erro retorna BadRequest
         return(BadRequest(ex.Message));
     }
 }
コード例 #2
0
        public IActionResult Delete(Guid id)
        {
            try
            {
                var professorTurma = _professorTurmaRepository.BuscarPorId(id);


                if (professorTurma == null)
                {
                    return(NotFound());
                }


                _professorTurmaRepository.Remover(id);

                return(Ok(id));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #3
0
        public IActionResult Delete(int id)
        {
            try
            {
                ProfessorTurma profturm = _professorturmaRepository.BuscarPorId(id);

                if (profturm == null)
                {
                    return(NotFound());
                }
                else
                {
                    //Passa o id do ProfessorTurma que será excluído
                    _professorturmaRepository.Remover(id);

                    return(Ok(profturm));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #4
0
        public IActionResult Delete(Guid id)
        {
            try
            {
                //busca professor pelo Id
                var prof = professorTRepository.BuscarPorId(id);

                //verifica se professor existe
                //caso não exista retorna NotFound
                if (prof == null)
                {
                    return(NotFound());
                }

                //caso exista remove o professor
                professorTRepository.Remover(id);
                //retorna Ok
                return(Ok(id));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }