private List <Snapshot_OriginalPublisher> CastOriginalPublishersToSnapshot( List <OriginalPublisher> originalPublishers, int caeNumber) { var snapshotList = new List <Snapshot_OriginalPublisher>(); foreach (var op in originalPublishers) { var snapshot = new Snapshot_OriginalPublisher(); snapshot.CloneWorksWriterCaeNumber = caeNumber; snapshot.Administrator = CastToAdministrator(op.Administrator, caeNumber); snapshot.CloneCaeNumber = op.CaeNumber; snapshot.IpCode = op.IpCode; snapshot.Controlled = op.Controlled; snapshot.FullName = op.FullName; snapshot.CapacityCode = op.CapacityCode; snapshot.Capacity = op.Capacity; snapshot.MechanicalCollectablePercentage = op.MechanicalCollectablePercentage.ToString(); snapshot.MechanicalOwnershipPercentage = op.MechanicalOwnershipPercentage.ToString(); snapshot.Affiliation = CastToOriginalPublisherAffiliationSnapshot(op.Affiliation, op.CaeNumber); if (op.KnownAs != null) { snapshot.KnownAs = CastToKnownAs(op.KnownAs, op.CaeNumber); } snapshotList.Add(snapshot); } return(snapshotList); }
public Snapshot_OriginalPublisher SaveSnapshotOriginalPublisher(Snapshot_OriginalPublisher originalPublisher) { using (var context = new DataContext()) { context.Snapshot_OriginalPublishers.Add(originalPublisher); context.SaveChanges(); return(originalPublisher); } }