public async Task <IActionResult> Edit(int id, [Bind("ReservaExcursaoId,Nome,DataReserva,NumPessoas,Cancelado,DataCancelar")] ReservaExcursao reservaExcursao) { if (id != reservaExcursao.ReservaExcursaoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(reservaExcursao); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReservaExcursaoExists(reservaExcursao.ReservaExcursaoId)) { return(NotFound()); } else { throw; } } ViewBag.title = "Excursão editada com sucesso"; ViewBag.type = "alert-sucess"; ViewBag.redirect = "/reservaExcursaos/Index"; //vai para pagInicial // todo: inform the user that the author was successfully edited return(View("Editado")); } return(View(reservaExcursao)); }
public async Task <IActionResult> Create([Bind("ReservaExcursaoId,Nome,DataReserva,NumPessoas,Cancelado,DataCancelar")] ReservaExcursao reservaExcursao) { if (ModelState.IsValid) { _context.Add(reservaExcursao); await _context.SaveChangesAsync(); ViewBag.title = "Excursão reservada com sucesso"; ViewBag.type = "alert-sucess"; ViewBag.redirect = "/reservaExcursaos/Index"; //vai para pagInicial return(View("Confirmacao")); // todo: inform the user that the author was successfully created } return(View(reservaExcursao)); }