internal void Remove(TableBase table) { switch (table) { case Firma f: f.MainPerson = null; SaveChanges(); while (f.SubTable.Any()) { Remove(f.SubTable.First()); } Firmy.Remove(f); break; case Divizia d: d.MainPerson = null; SaveChanges(); while (d.SubTable.Any()) { Remove(d.SubTable.First()); } Divizie.Remove(d); break; case Projekt p: p.MainPerson = null; SaveChanges(); while (p.SubTable.Any()) { Remove(p.SubTable.First()); } Projekty.Remove(p); break; case Oddelenie o: o.MainPerson = null; SaveChanges(); Oddelenia.Remove(o); break; default: throw new ArgumentOutOfRangeException(); } }
internal void Add(TableBase table) { switch (table) { case Firma f: Firmy.Add(f); break; case Divizia d: Divizie.Add(d); break; case Projekt p: Projekty.Add(p); break; case Oddelenie o: Oddelenia.Add(o); break; default: throw new ArgumentOutOfRangeException(); } }