public async Task <IActionResult> Edit(int id, [Bind("MatriculaId,AlunoId,Etapa1,Etapa2,Turno1Lanchonete,Turno2Lanchonete")] Matricula matricula) { if (id != matricula.MatriculaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(matricula); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MatriculaExists(matricula.MatriculaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AlunoId"] = new SelectList(_context.Alunos, "AlunoId", "Nome", matricula.AlunoId); ViewData["Etapa1"] = new SelectList(_context.Salas, "SalaId", "Nome", matricula.Etapa1); ViewData["Etapa2"] = new SelectList(_context.Salas, "SalaId", "Nome", matricula.Etapa2); ViewData["Turno1Lanchonete"] = new SelectList(_context.Lanchonetes, "LanchoneteId", "Nome", matricula.Turno1Lanchonete); ViewData["Turno2Lanchonete"] = new SelectList(_context.Lanchonetes, "LanchoneteId", "Nome", matricula.Turno2Lanchonete); return(View(matricula)); }
public async Task <IActionResult> Edit(int id, [Bind("AlunoId,Nome,Sobrenome")] Aluno aluno) { if (id != aluno.AlunoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(aluno); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlunoExists(aluno.AlunoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(aluno)); }
public async Task <IActionResult> Edit(int id, [Bind("SalaId,Nome,Capacidade")] Sala sala) { if (id != sala.SalaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sala); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalaExists(sala.SalaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sala)); }
public async Task <IActionResult> Edit(int id, [Bind("LanchoneteId,Nome")] Lanchonete lanchonete) { if (id != lanchonete.LanchoneteId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lanchonete); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LanchoneteExists(lanchonete.LanchoneteId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(lanchonete)); }