Exemple #1
0
 public Snapshot_ComposerAffiliationBase SaveComposerAffiliatioBasenSnapshot(Snapshot_ComposerAffiliationBase composerSnapshot)
 {
     using (var context = new DataContext())
     {
         context.Snapshot_ComposerAffiliationBases.Add(composerSnapshot);
         context.SaveChanges();
         return(composerSnapshot);
     }
 }
        private List <Snapshot_ComposerAffiliationBase> castToComposerAffiliationsBases(List <AffiliationBase> affiliations,
                                                                                        int caeNumber)
        {
            var snapshotList = new List <Snapshot_ComposerAffiliationBase>();

            if (affiliations != null)
            {
                foreach (var affiliation in affiliations)
                {
                    var snapshot = new Snapshot_ComposerAffiliationBase();
                    snapshot.EndDate              = affiliation.EndDate;
                    snapshot.StartDate            = affiliation.StartDate;
                    snapshot.SocietyAcronym       = affiliation.SocietyAcronym;
                    snapshot.CloneWriterCaeNumber = caeNumber;

                    snapshotList.Add(snapshot);
                }
            }
            return(snapshotList);
        }
Exemple #3
0
        public bool DeleteComposerAffiliationBaseSnapshotByComposer(Snapshot_ComposerAffiliationBase composerToDelete)
        {
            using (var context = new DataContext())
            {
                var composer =
                    context.Snapshot_ComposerAffiliationBases
                    .Find(composerToDelete.SnapshotComposerAffiliationBaseId);

                context.Snapshot_ComposerAffiliationBases.Attach(composer);
                context.Snapshot_ComposerAffiliationBases.Remove(composer);
                try
                {
                    context.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
                return(true);
            }
        }