public static void Update(this Partner target, AbstractEntities.PartnerUpdate source)
        {
            if (source == null || target == null)
            {
                return;
            }

            target.Address = source.Address;
            target.Name    = source.Name;
        }
示例#2
0
        public AbstractEntities.Partner UpdatePartner(AbstractEntities.PartnerUpdate partnerUpdate)
        {
            if (partnerUpdate == null)
            {
                throw new ArgumentNullException("partnerUpdate");
            }

            lock (syncObject)
            {
                var record = context.Partners.SingleOrDefault(p => p.Id == partnerUpdate.Id);
                if (record == null)
                {
                    throw new RecordDoesNotExistException($"Partner with ID {partnerUpdate.Id} does not exist.");
                }

                record.Update(partnerUpdate);

                context.SaveChanges();

                return(record.ToAbstract());
            }
        }