Пример #1
0
 public void Add(Genre genre)
 {
     using (var ctx = new MovieShopContext())
     {
         //Create the queries
         ctx.Genres.Add(genre);
         //Execute the queries
         ctx.SaveChanges();
     }
 }
Пример #2
0
        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();

                    }
                }
            }
        }
Пример #3
0
        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"
            };
        }
Пример #4
0
 public ActionResult Edit(Genre genre)
 {
     facade.GetGenreRepository().Edit(genre);
     return Redirect("Index");
 }
Пример #5
0
 public ActionResult Create(Genre genreName)
 {
     facade.GetGenreRepository().Add(genreName);
     return Redirect("Index");
 }
Пример #6
0
 public ActionResult Update(Genre genre)
 {
     facade.GetGenresRepository().Update(genre);
     return RedirectToAction("Index", "Genre");
 }
Пример #7
0
 public ActionResult Create(Genre genre)
 {
     db.Genres.Add(genre);
     db.SaveChanges();
     return RedirectToAction("Index");
 }