예제 #1
0
파일: DB_DAL.cs 프로젝트: gobdonuts/PFI-WEB
        public static bool RemoveFilm(this DBEntities DB, FilmView filmView)
        {
            Film film = DB.Films.Find(filmView.Id);

            BeginTransaction(DB);
            SetFilmCastings(DB, film.Id, null);
            DB.Films.Remove(film);
            DB.SaveChanges();
            Commit();
            return(true);
        }
예제 #2
0
파일: DB_DAL.cs 프로젝트: gobdonuts/PFI-WEB
        public static bool UpdateFilm(this DBEntities DB, FilmView filmView, List <int> actorsIdList)
        {
            Film film = DB.Films.Find(filmView.Id);

            filmView.ToFilm(film);
            BeginTransaction(DB);
            DB.Entry(film).State = EntityState.Modified;
            DB.SaveChanges();
            SetFilmCastings(DB, film.Id, actorsIdList);
            Commit();
            return(true);
        }
예제 #3
0
파일: DB_DAL.cs 프로젝트: gobdonuts/PFI-WEB
        public static FilmView AddFilm(this DBEntities DB, FilmView filmView, List <int> actorsIdList)
        {
            Film film = new Film();

            filmView.ToFilm(film);
            BeginTransaction(DB);
            film = DB.Films.Add(film);
            DB.SaveChanges();
            SetFilmCastings(DB, film.Id, actorsIdList);
            Commit();
            return(film.ToFilmView());
        }