//retorna uma nova instância de locação
        private Location GetNewLocation()
        {
            var location = new Location();

            location.MovieList = MovieDAO.FindAll();
            return(location);
        }
Пример #2
0
        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()));
        }
Пример #4
0
        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));
        }
Пример #5
0
        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()));
        }
Пример #6
0
 public List <Movie> GetMovies()
 {
     return(_movieDAO.FindAll());
 }