コード例 #1
0
 public static List <MovieType> GetAllMovieType()
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.MovieType.ToList());
     }
 }
コード例 #2
0
 public static Movie GetMovie(int id)
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Movie.Find(id));
     }
 }
コード例 #3
0
 public static Director GetDirector(int id)
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Director.Find(id));
     }
 }
コード例 #4
0
 public static List <Director> GetAllDirector()
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Director.ToList());
     }
 }
コード例 #5
0
 public static void AddMovie(Movie movie)
 {
     using (IMDBDB db = new IMDBDB())
     {
         db.Movie.Add(movie);
         db.SaveChanges();
     }
 }
コード例 #6
0
 public static void AddDirector(Director director)
 {
     using (IMDBDB db = new IMDBDB())
     {
         db.Director.Add(director);
         db.SaveChanges();
     }
 }
コード例 #7
0
 public static void DeleteMovie(int id)
 {
     using (IMDBDB db = new IMDBDB())
     {
         var result = db.Movie.Find(id);
         db.Movie.Remove(result);
         db.SaveChanges();
     }
 }
コード例 #8
0
 public static void UpdateDirector(int id, string name)
 {
     using (IMDBDB db = new IMDBDB())
     {
         var result = db.Director.Find(id);
         result.DirectorName = name;
         db.SaveChanges();
     }
 }
コード例 #9
0
 public static void DeleteDirector(int id)
 {
     using (IMDBDB db = new IMDBDB())
     {
         var result = db.Director.Find(id);
         db.Director.Remove(result);
         db.SaveChanges();
     }
 }
コード例 #10
0
 public static List <WiewDirectorMovie> GetAllDMovies(int directorid)
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Movie.Where(b => b.DirectorID == directorid).Select(b => new WiewDirectorMovie
         {
             MovieID = b.MovieID,
             MovieName = b.MovieName,
             DirectorID = b.DirectorID,
             DirectorName = b.Director.DirectorName,
         }).ToList());
     }
 }
コード例 #11
0
 public static void UpdateMovie(int id, string name, string subject, int rating, int director, int type, DateTime realise)
 {
     using (IMDBDB db = new IMDBDB())
     {
         var result = db.Movie.Find(id);
         result.MovieName    = name;
         result.MovieSubject = subject;
         result.MovieRating  = rating;
         result.DirectorID   = director;
         result.MovieTypeID  = type;
         result.RealiseDate  = realise;
         db.SaveChanges();
     }
 }
コード例 #12
0
 public static List <WiewMovie> GetAllMovieType(int id)
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Movie.Where(b => b.MovieTypeID == id).Select(b => new WiewMovie
         {
             MovieID = b.MovieID,
             MovieName = b.MovieName,
             DirectorID = b.DirectorID,
             DirectorName = b.Director.DirectorName,
             MovieRating = b.MovieRating,
             MovieSubject = b.MovieSubject,
             MovieTypeName = b.MovieType.MovieTypeName
         }).ToList());
     }
 }
コード例 #13
0
 public static List <WiewMovie> GetAllDRating()
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Movie.OrderByDescending(b => b.MovieRating).Select(b => new WiewMovie
         {
             MovieID = b.MovieID,
             MovieName = b.MovieName,
             DirectorID = b.DirectorID,
             DirectorName = b.Director.DirectorName,
             MovieRating = b.MovieRating,
             MovieSubject = b.MovieSubject,
             MovieTypeName = b.MovieType.MovieTypeName
         }).ToList());
     }
 }
コード例 #14
0
 public static List <WiewMovie> GetAllMovie()
 {
     using (IMDBDB db = new IMDBDB())
     {
         return(db.Movie.Select(b => new WiewMovie
         {
             MovieID = b.MovieID,
             MovieName = b.MovieName,
             MovieSubject = b.MovieSubject,
             RealiseDate = b.RealiseDate,
             MovieRating = b.MovieRating,
             MovieTypeName = b.MovieType.MovieTypeName,
             DirectorName = b.Director.DirectorName,
         }).ToList());
     }
 }