public Snapshot_Affiliation SaveSnapshotAffiliation(Snapshot_Affiliation snapshotAffiliation) { using (var context = new DataContext()) { context.Snapshot_Affiliations.Add(snapshotAffiliation); context.SaveChanges(); return(snapshotAffiliation); } }
private List <Snapshot_Affiliation> CastToAffiliationSnapshot(List <Affiliation> affiliations, int caeNumber) { var snapshotList = new List <Snapshot_Affiliation>(); if (affiliations != null) { foreach (var affilation in affiliations) { var snapshot = new Snapshot_Affiliation(); snapshot.CloneWriterCaeNumber = caeNumber; snapshot.WriterCaeNumber = caeNumber; snapshot.IncomeGroup = affilation.IncomeGroup; snapshot.Affiliations = CastToAffiliationBaseSnapshot(affilation.Affiliations, caeNumber); snapshotList.Add(snapshot); } } return(snapshotList); }