public static void Update(this Currency target, AbstractEntities.CurrencyUpdate source) { if (source == null || target == null) { return; } target.Code = source.Code; }
public AbstractEntities.Currency UpdateCurrency(AbstractEntities.CurrencyUpdate currencyUpdate) { if (currencyUpdate == null) { throw new ArgumentNullException("currencyUpdate"); } lock (syncObject) { var record = context.Currencies.SingleOrDefault(c => c.Id == currencyUpdate.Id); if (record == null) { throw new RecordDoesNotExistException($"Currency with ID {currencyUpdate.Id} does not exist."); } record.Update(currencyUpdate); context.SaveChanges(); return(record.ToAbstract()); } }