private List <Snapshot_Administrator> CastToAdministrator(List <WriterBase> admins, int caeNumber)
        {
            var snapshotList = new List <Snapshot_Administrator>();

            if (admins != null)
            {
                foreach (var admin in admins)
                {
                    var snapshot = new Snapshot_Administrator();

                    snapshot.CloneCaeNumber = admin.CaeNumber;
                    snapshot.IpCode         = admin.IpCode;
                    snapshot.FullName       = admin.FullName;
                    snapshot.CapacityCode   = admin.CapacityCode;
                    snapshot.Capacity       = admin.Capacity;
                    snapshot.Controlled     = admin.Controlled;
                    snapshot.MechanicalCollectablePercentage = (int)admin.MechanicalCollectablePercentage;
                    snapshot.MechanicalOwnershipPercentage   = (int)admin.MechanicalOwnershipPercentage;
                    snapshot.Affiliation = CastToAdminAffiliationSnapshot(admin.Affiliation, admin.CaeNumber);
                    if (admin.KnownAs != null)
                    {
                        snapshot.KnownAs = CastToAdminKnownAs(admin.KnownAs, admin.CaeNumber);
                    }
                    snapshotList.Add(snapshot);
                }
            }
            return(snapshotList);
        }
Beispiel #2
0
 public Snapshot_Administrator SaveSnapshotAdministrator(Snapshot_Administrator administratorSnapshot)
 {
     using (var context = new DataContext())
     {
         context.Snapshot_Administrators.Add(administratorSnapshot);
         context.SaveChanges();
         return(administratorSnapshot);
     }
 }