Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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());
        }