//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(); }
public void ajouterfilm_categories(Film_Category fc) { try { Context.Film_Categories.Add(fc); Context.SaveChanges(); } catch (Exception ex) { throw; } }