public async Task <IActionResult> Edit(int id, [Bind("ReservaVisitaId,TuristaId,VisitasGuiadasId,DataReserva,NPessoas")] ReservaVisita reservaVisita) { if (id != reservaVisita.ReservaVisitaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(reservaVisita); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReservaVisitaExists(reservaVisita.ReservaVisitaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["VisitasGuiadasId"] = new SelectList(_context.Set <VisitasGuiadas>(), "VisitasGuiadasId", "Nome", reservaVisita.VisitasGuiadasId); return(View(reservaVisita)); }
public async Task <IActionResult> Create([Bind("TuristaId,VisitasGuiadasId,DataReserva,NPessoas")] ReservaVisita reservaVisita) { if (ModelState.IsValid) { _context.Add(reservaVisita); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["VisitasGuiadasId"] = new SelectList(_context.Set <VisitasGuiadas>(), "VisitasGuiadasId", "Nome", reservaVisita.VisitasGuiadasId); return(View(reservaVisita)); }