public IActionResult Edit(int id, [Bind("Id,Nome,Sexo,Email,Nascimento")] Aluno aluno) { if (id != aluno.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update <Aluno>(aluno); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AlunoExiste(aluno.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(aluno)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Email,Rg")] Aluno aluno) { if (id != aluno.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(aluno); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlunoExists(aluno.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(aluno)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nota")] Matricula matricula) { if (id != matricula.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(matricula); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MatriculaExists(matricula.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(matricula)); }
public async Task <IActionResult> Edit(Curso curso) { if (ModelState.IsValid) { try { _context.Update(curso); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CursoExists(curso.CursoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(curso)); }
public void update(int id, Aluno aluno) { context.Update(aluno); context.SaveChanges(); }