Exemplo n.º 1
0
 //Add Film With Cat And ACtor
 public void AddFilms(Film F, List <Actor> Actor, List <Category> Category)
 {
     Context.Films.Add(F);
     Actor    = Actor.ToList();
     Category = Category.ToList();
     if (Actor != null && Actor.Count != 0)
     {
         foreach (Actor A in Actor)
         {
             Film_Actor FA = new Film_Actor();
             FA.Film  = F;
             FA.Actor = A;
             Context.Film_Actors.Add(FA);
         }
     }
     if (Category != null && Category.Count != 0)
     {
         foreach (Category c in Category)
         {
             Film_Category FC = new Film_Category();
             FC.Film     = F;
             FC.Category = c;
             Context.Film_Categories.Add(FC);
         }
     }
     Context.SaveChanges();
 }
Exemplo n.º 2
0
 public void ajouterfilm_actor(Film_Actor fa)
 {
     try
     {
         Context.Film_Actors.Add(fa);
         Context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemplo n.º 3
0
 //Add Actor With Films
 public void AddActors(Actor A, ICollection <Film> F)
 {
     Context.Actors.Add(A);
     F = F.ToList();
     if (F != null || F.Count != 0)
     {
         foreach (Film f in F)
         {
             Film_Actor FA = new Film_Actor();
             FA.Film  = f;
             FA.Actor = A;
             Context.Film_Actors.Add(FA);
         }
     }
     Context.SaveChanges();
 }