public static void AddConComp(int Company, ConComp comp) { using (var dbContext = new DataContext()) { dbContext.Companies.Where(x => x.CompanyId == Company).Include(x => x.ConComps).First().ConComps.Add(comp); dbContext.SaveChanges(); } }
public static void RemoveConComp(ConComp conComp) { using (var dbContext = new DataContext()) { dbContext.ContactCompanies.Remove(conComp); dbContext.SaveChanges(); } }
public static void AddConComp(int Company, string conName, string sec, string notes) { using (var dbContext = new DataContext()) { ConComp comp = new ConComp() { CompanyName = conName, Sector = sec, StaffNotes = notes }; dbContext.Companies.Where(x => x.CompanyId == Company).Include(x => x.ConComps).First().ConComps.Add(comp); dbContext.SaveChanges(); } }