예제 #1
0
 public void Add(Movie movie)
 {
     using (var ctx = new MovieStoreContext())
     {
         ctx.Movies.Add(movie);
         ctx.SaveChanges();
     }
 }
예제 #2
0
        public void orderline_properties_set_test()
        {
            OrderLine line = new OrderLine();
            var movie = new Movie() { Id = 1, Title = "Bog Foot" };
            line.Movie = movie;
            line.Amount = 10;

            Assert.AreEqual(line.Movie, movie, "My movie ");
            Assert.AreEqual(line.Amount, 10, "Amount should be 10");
        }
예제 #3
0
 public ActionResult Edit(Movie movie)
 {
     if (ModelState.IsValid)
     {
         fac.GetMovieRepository().UpdateMovie(movie);
         return RedirectToAction("Index");
     }
     ViewBag.GenreId = new SelectList(fac.GetGenryRepository().ReadAll(), "GenreId", "Name", movie);
     return View();
 }
예제 #4
0
 public ActionResult Create(Movie mov,FormCollection collection)
 {
     if (ModelState.IsValid)
     {
         fac.GetMovieRepository().Add(mov);
         return RedirectToAction("Index");
     }
     ViewBag.GenreId = new SelectList(fac.GetGenryRepository().ReadAll(), "Id", "Name");
     return View();
 }
예제 #5
0
 public void UpdateMovie(Movie movie)
 {
     using (var ctx = new MovieStoreContext())
     {
         Movie m = ctx.Movies.Where(x => x.Id == movie.Id).First();
         m.ImageUrl = movie.ImageUrl;
         m.Title = movie.Title;
         m.Price = movie.Price;
         m.Year = movie.Year;
         m.TralierUrl = movie.TralierUrl;
         m.Genre = movie.Genre;
         m.GenreId = movie.GenreId;
         ctx.SaveChanges();
     }
 }
예제 #6
0
 public ActionResult Edit(Movie movie)
 {
     facade.GetMovieRepository().UpdateMovie(movie);
     return Redirect("Index");
 }
예제 #7
0
 public ActionResult Create(Movie movie)
 {
     facade.GetMovieRepository().Add(movie);
     return Redirect("Index");
 }