// GET: UsersController/Delete/5 public async Task <ActionResult> Delete(string email) { var user = await _userManager.FindByEmailAsync(email); var aluno = await _dbContext.Alunos.Where(a => a.Email == email).SingleOrDefaultAsync(); if (aluno != null) { await _dbContext.RemoverDadosAlunoAsync(aluno.Id); _dbContext.Alunos.Remove(aluno); await _dbContext.SaveChangesAsync(); } _ = await _userManager.DeleteAsync(user); return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteConfirmed(int id) { await _context.RemoverDadosAlunoAsync(id); Aluno aluno = await _context.Alunos.FindAsync(id); _context.Remove(aluno); return(RedirectToAction(nameof(Index))); }