public async Task <IActionResult> Edit(int id, [Bind("Id,Nome")] Instrutor instrutor) { if (id != instrutor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(instrutor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InstrutorExists(instrutor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(instrutor)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,DataNascimento")] 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,AlunoId,CursoId,InstrutorId,Data,AvaliacaoSala,AvaliacaoPontualidade,AvaliacaoConteudo,AvaliacaoInstrutor,Dificuldade,Sugestao")] Avaliacao avaliacao) { if (id != avaliacao.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(avaliacao); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AvaliacaoExists(avaliacao.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AlunoId"] = new SelectList(_context.Alunos, "Id", "Nome", avaliacao.AlunoId); ViewData["CursoId"] = new SelectList(_context.Cursos, "Id", "Nome", avaliacao.CursoId); ViewData["InstrutorId"] = new SelectList(_context.Instrutores, "Id", "Nome", avaliacao.InstrutorId); return(View(avaliacao)); }