コード例 #1
0
 public Snapshot_ComposerAffiliation SaveComposerAffiliationSnapshot(Snapshot_ComposerAffiliation composerSnapshot)
 {
     using (var context = new DataContext())
     {
         context.Snapshot_ComposerAffiliations.Add(composerSnapshot);
         context.SaveChanges();
         return(composerSnapshot);
     }
 }
コード例 #2
0
        private List <Snapshot_ComposerAffiliation> CastToComposerAffiliations(List <Affiliation> affiliations,
                                                                               int caeNumber)
        {
            var snapshotList = new List <Snapshot_ComposerAffiliation>();

            if (affiliations != null)
            {
                foreach (var affiliation in affiliations)
                {
                    var snapshot = new Snapshot_ComposerAffiliation();
                    snapshot.IncomeGroup          = affiliation.IncomeGroup;
                    snapshot.CloneWriterCaeNumber = caeNumber;
                    snapshot.WriterCaeNumber      = caeNumber;
                    snapshot.Affiliations         = castToComposerAffiliationsBases(affiliation.Affiliations, caeNumber);

                    snapshotList.Add(snapshot);
                }
            }
            return(snapshotList);
        }
コード例 #3
0
        public bool DeleteComposerAffiliationSnapshotByComposer(Snapshot_ComposerAffiliation composerToDelete)
        {
            using (var context = new DataContext())
            {
                var composer =
                    context.Snapshot_ComposerAffiliations
                    .Find(composerToDelete.SnapshotComposerAffiliationId);

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