public void Add(Genre genre) { using (var ctx = new MovieShopContext()) { //Create the queries ctx.Genres.Add(genre); //Execute the queries ctx.SaveChanges(); } }
public void Update(Genre genre) { using (var ctx = new MovieShopContext()) { foreach (var movieDB in ctx.Genres.ToList()) { if (genre.Id == movieDB.Id) { movieDB.Name = genre.Name; ctx.SaveChanges(); } } } }
public void Setup() { //ResetDB(); line = new OrderLine(); Genre g1 = new Genre() { Name = "Action" }; Genre g2 = new Genre() { Name = "Drama" }; movie = new Movie() { Title = "The Shawshank Redemption", Year = 1994, Price = 9.99, Genres = new List<Genre> { g1, g2 }, ImageURL = "http://ia.media-imdb.com/images/M/MV5BODU4MjU4NjIwNl5BMl5BanBnXkFtZTgwMDU2MjEyMDE@._V1_SX214_AL_.jpg", TrailerURL = "https://www.youtube.com/embed/NmzuHjWmXOc" }; }
public ActionResult Edit(Genre genre) { facade.GetGenreRepository().Edit(genre); return Redirect("Index"); }
public ActionResult Create(Genre genreName) { facade.GetGenreRepository().Add(genreName); return Redirect("Index"); }
public ActionResult Update(Genre genre) { facade.GetGenresRepository().Update(genre); return RedirectToAction("Index", "Genre"); }
public ActionResult Create(Genre genre) { db.Genres.Add(genre); db.SaveChanges(); return RedirectToAction("Index"); }