コード例 #1
0
        CastToComposerOriginalPublisherAdminAffiliationBase(List <AffiliationBase> affiliationBases, int CaeNumber)
        {
            var snapshotList = new List <Snapshot_ComposerOriginalPublisherAdminAffiliationBase>();

            if (affiliationBases != null)
            {
                foreach (var affiliationBase in affiliationBases)
                {
                    var snapshot = new Snapshot_ComposerOriginalPublisherAdminAffiliationBase();
                    snapshot.CloneWriterCaeNumber = CaeNumber;
                    snapshot.EndDate        = affiliationBase.EndDate;
                    snapshot.SocietyAcronym = affiliationBase.SocietyAcronym;
                    snapshot.StartDate      = affiliationBase.StartDate;

                    snapshotList.Add(snapshot);
                }
            }
            return(snapshotList);
        }
        public bool DeleteComposerOriginalPublisherAdminAffiliationBase(Snapshot_ComposerOriginalPublisherAdminAffiliationBase composerToDelete)
        {
            using (var context = new DataContext())
            {
                var composer =
                    context.Snapshot_ComposerOriginalPublisherAdminAffiliationBases
                    .Find(composerToDelete.SnapshotComposerOriginalPublisherAdminAffiliationBaseId);

                context.Snapshot_ComposerOriginalPublisherAdminAffiliationBases.Attach(composer);
                context.Snapshot_ComposerOriginalPublisherAdminAffiliationBases.Remove(composer);
                try
                {
                    context.SaveChanges();
                }
                catch (Exception)
                {
                    return(false);
                }
                return(true);
            }
        }
 public Snapshot_ComposerOriginalPublisherAdminAffiliationBase SaveComposerOriginalPublisherAdminAffiliationBase(Snapshot_ComposerOriginalPublisherAdminAffiliationBase sampleSnapshot)
 {
     using (var context = new DataContext())
     {
         context.Snapshot_ComposerOriginalPublisherAdminAffiliationBases.Add(sampleSnapshot);
         context.SaveChanges();
         return(sampleSnapshot);
     }
 }