Ejemplo n.º 1
0
        public async Task <ActionResult <Professor> > DeleteProfessor(string cpf)
        {
            var professor = await _professorService.RemoveProfessorAsync(cpf);

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

            return(professor);
        }
        public async Task <IActionResult> Delete(int id)
        {
            try
            {
                await _professorService.RemoveProfessorAsync(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (DbUpdateException e)
            {
                throw new IntegrityException(e.Message);
            }
        }