public void Add(Movie movie) { using (var ctx = new MovieStoreContext()) { ctx.Movies.Add(movie); ctx.SaveChanges(); } }
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"); }
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(); }
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(); }
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(); } }
public ActionResult Edit(Movie movie) { facade.GetMovieRepository().UpdateMovie(movie); return Redirect("Index"); }
public ActionResult Create(Movie movie) { facade.GetMovieRepository().Add(movie); return Redirect("Index"); }