public ActionResult AlterarAventura(Aventura aventura, HttpPostedFileBase file) { ConteudoFacade facade = new ConteudoFacade(); UsuarioFacade usuarioFacade = new UsuarioFacade(); facade.SalvarAventura(aventura, file); //TODO: throw new Exception("hello"); return RedirectToAction("Index"); }
public ActionResult CadastrarAventura() { ConteudoFacade facade = new ConteudoFacade(); UsuarioFacade usuarioFacade = new UsuarioFacade(); ViewData["Autores"] = new SelectList(usuarioFacade.PesquisarUsuario(null), "Codigo", "Nome"); ViewData["AventurasAnteriores"] = new SelectList(facade.PesquisarAventura(null), "Codigo", "Titulo"); Aventura aventura = new Aventura() { Data = DateTime.Now }; return View(aventura); }
public ActionResult CadastrarAventura(Aventura aventura, HttpPostedFileBase Rota) { ConteudoFacade facade = new ConteudoFacade(); UsuarioFacade usuarioFacade = new UsuarioFacade(); try { facade.SalvarAventura(aventura, Rota); return RedirectToAction("Index"); } catch { ViewData["Autores"] = new SelectList(usuarioFacade.PesquisarUsuario(null), "Codigo", "Nome"); ViewData["AventurasAnteriores"] = new SelectList(facade.PesquisarAventura(null), "Codigo", "Titulo"); return View(aventura); } return RedirectToAction("Index"); }