public async Task EditAsync(int id,
                                    string title,
                                    string description,
                                    int?ageRestriction,
                                    DateTime releaseDate,
                                    string director,
                                    string cast,
                                    GenreTypes genre,
                                    string videoId,
                                    string thumbnailUrl)
        {
            var movieExist = await this.db.Movies.FindAsync(id);

            if (movieExist == null)
            {
                return;
            }

            movieExist.AgeRestriction = ageRestriction;
            movieExist.Cast           = cast;
            movieExist.Description    = description;
            movieExist.Director       = director;
            movieExist.Genre          = genre;
            movieExist.ReleaseDate    = releaseDate;
            movieExist.ThumbnailUrl   = thumbnailUrl;
            movieExist.Title          = title;
            movieExist.VideoId        = videoId;

            await this.db.SaveChangesAsync();
        }
        public async Task CreateAsync(string title,
                                      string description,
                                      int?ageRestriction,
                                      DateTime releaseDate,
                                      string director,
                                      string cast,
                                      GenreTypes genre,
                                      string videoId,
                                      string thumbnailUrl)
        {
            var movie = new Movie
            {
                Title          = title,
                Description    = description,
                AgeRestriction = ageRestriction,
                ReleaseDate    = releaseDate,
                Director       = director,
                Cast           = cast,
                Genre          = genre,
                VideoId        = videoId,
                ThumbnailUrl   = thumbnailUrl
            };

            await this.db.Movies.AddAsync(movie);

            await this.db.SaveChangesAsync();
        }
 public Game(int id, string title, GenreTypes genre, GameTypes type, int releaseYear, double popularity)
 {
     Id               = id;
     Title            = title;
     Genre            = genre;
     Type             = type;
     ReleaseYear      = releaseYear;
     PopularityRating = popularity;
 }
Beispiel #4
0
 public List <Movie> getMoviesByGenre(GenreTypes genre)
 {
     using (var context = new MovieStoreEDM())
     {
         List <Movie> movies = (from p in context.Movies1
                                where p.Genre == genre.ToString()
                                select p).ToList <Movie>();
         return(movies);
     }
 }