Пример #1
0
 public string Details(Actor actor, Genre genre)
 {
     db.Genres.Add(genre);
     db.Actors.Add(actor);
     db.SaveChanges();
     return("The Genre of this movie is: " + genre.Name + " And actors played in it " + actor.SecondName);
 }
Пример #2
0
        public imdbController(imdbContext context)
        {
            _context = context;

            if (_context.Movies.Count() == 0)
            {
                _context.Movies.Add(new Movie {
                    Tittle = "Friends", MovieYear = 2001, Description = "NY city apartament without black people", RunTime = "1000plus hours"
                });
                _context.Movies.Add(new Movie {
                    Tittle = "GodFather", MovieYear = 1971, Description = "Italian Mafia in US", RunTime = "3 amazing hours"
                });
                _context.Movies.Add(new Movie {
                    Tittle = "Memento", MovieYear = 2004, Description = "To much hard detective", RunTime = "2 hours"
                });
                _context.SaveChanges();
            }
        }
Пример #3
0
 public IActionResult Create(Movie movie)
 {
     _context.Movies.Add(movie);
     _context.SaveChanges();
     return(CreatedAtRoute("GetMovie", new { id = movie.MovieId }, movie));
 }