Esempio n. 1
0
        public ActionResult Create(Movie movie)
        {
            if (ModelState.IsValid)
            {
                _movieRepository.Add(movie);
                Success("Your movie has been added.");
                return RedirectToAction("Index");
            }

            ViewBag.PossibleDirectors = _personRepository.Get();
            return View(movie);
        }
Esempio n. 2
0
        public ActionResult Edit(Movie movie)
        {
            if (ModelState.IsValid)
            {
                _movieRepository.Update(movie);
                Success("Your movie was updated");
                return RedirectToAction("Index");
            }

            Error("Could not save your movie");
            ViewBag.PossibleDirectors = _personRepository.Get();
            return View(movie);
        }
Esempio n. 3
0
 //
 // GET: /Movies/Create
 public ActionResult Create()
 {
     ViewBag.PossibleDirectors = _personRepository.Get();
     var movie = new Movie();
     return View(movie);
 }
Esempio n. 4
0
 public void Update(Movie movie)
 {
     var oldMovie = Get(movie.Id);
     _context.Entry(oldMovie).CurrentValues.SetValues(movie);
     _context.SaveChanges();
 }