Esempio n. 1
0
 public void EditFilm(Film film, Desctiption description, ProducerStaff staff)
 {
     Film editFilm = _context.Films.Find(film.Id);
     _context.Entry<Film>(editFilm).CurrentValues.SetValues(film);
     Desctiption editDescr = _context.Desctiption.Where(d => d.Film_Id == film.Id).FirstOrDefault();
     description.Film_Id = editDescr.Film_Id;
     _context.Entry<Desctiption>(editDescr).CurrentValues.SetValues(description);
     ProducerStaff editStaff = _context.ProducerStaff.Where(s => s.Film_Id == film.Id).FirstOrDefault();
     staff.Film_Id = editStaff.Film_Id;
     _context.Entry<ProducerStaff>(editStaff).CurrentValues.SetValues(staff);
     _context.SaveChanges();
 }
Esempio n. 2
0
 public void AddNewFilm(Film film, Desctiption description, ProducerStaff staff)
 {
     Film filmToAdd = new Film();
     filmToAdd = film;
     filmToAdd.desctiption = description;
     filmToAdd.producerstaff = staff;
     _context.Films.Add(filmToAdd);
     _context.Entry<Film>(filmToAdd).State = EntityState.Added;
     _context.SaveChanges();
 }