public async Task <AccountUpdateResult> UpdateAsync(AccountUpdateArgs args) { AccountUpdateResult logicResult = new AccountUpdateResult(); try { Account account = args.Account.ToEntity(); Account existingAccount = await _context.Set <Account>().Where(x => x.AccountId == account.AccountId) .FirstAsync() .ConfigureAwait(false); account.Id = existingAccount.Id; account.AccountId = existingAccount.AccountId; account.MetaCreatedTimeCode = existingAccount.MetaCreatedTimeCode; account.MetaIsDeleted = existingAccount.MetaIsDeleted; account.MetaRowVersion = existingAccount.MetaRowVersion; EntitiesExpress.CopyProperties(account, existingAccount); existingAccount.MetaModifiedTimeCode = DateTime.UtcNow.ToSuperEpochUtc(); _ = await _context.SaveChangesAsync() .ConfigureAwait(false); } catch (Exception ex) { logicResult.Exception = ex; } return(logicResult); }
public async Task <TransactionUpdateResult> UpdateAsync(TransactionUpdateArgs args) { TransactionUpdateResult logicResult = new TransactionUpdateResult(); try { Transaction newEntity = args.Transaction.ToEntity(); Transaction existingEntity = await _context.Set <Transaction>().Where(x => x.TransactionId == newEntity.TransactionId) .FirstAsync() .ConfigureAwait(false); newEntity.Id = existingEntity.Id; newEntity.MetaCreatedTimeCode = existingEntity.MetaCreatedTimeCode; newEntity.MetaIsDeleted = existingEntity.MetaIsDeleted; newEntity.MetaRowVersion = existingEntity.MetaRowVersion; EntitiesExpress.CopyProperties(newEntity, existingEntity); existingEntity.MetaModifiedTimeCode = DateTime.UtcNow.ToSuperEpochUtc(); await _context.SaveChangesAsync() .ConfigureAwait(false); } catch (Exception ex) { logicResult.Exception = ex; } return(logicResult); }