//retorna uma nova instância de locação private Location GetNewLocation() { var location = new Location(); location.MovieList = MovieDAO.FindAll(); return(location); }
public ActionResult Index() { //se não tiver alguém logado retorna pra tela de login if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } return(View(MovieDAO.FindAll())); }
public ActionResult Insert() { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } var location = new Location(); location.MovieList = MovieDAO.FindAll(); return(View(GetNewLocation())); }
public ActionResult Insert(Movie movie) { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } if (ModelState.IsValid) { //insere novo ou edita filme no DB MovieDAO.Insert(movie); return(View("Index", MovieDAO.FindAll())); } ViewBag.Genre = GenreDAO.FindAll(); return(View("Insert", movie)); }
public ActionResult Delete(int[] Id) { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } if (Id == null) { ModelState.AddModelError("", "Nenhum item foi selecionado para deletar"); } if (ModelState.IsValid) { MovieDAO.Delete(Id); } return(View("Index", MovieDAO.FindAll())); }
public List <Movie> GetMovies() { return(_movieDAO.FindAll()); }