public async Task AddAsync(ISmartVoucherPayment payment) { using (var context = _contextFactory.CreateDataContext()) { var entity = SmartVoucherPaymentEntity.Create(payment); var historyEntity = TransactionHistoryEntity.CreateForSmartVoucherPayment(payment); context.SmartVoucherPayments.Add(entity); context.TransactionHistories.Add(historyEntity); await context.SaveChangesAsync(); } }
public async Task AddPaymentAsync(SmartVoucherPaymentDto payment) { using (var context = _contextFactory.CreateDataContext()) { var entity = SmartVoucherPaymentEntity.Create(payment); var historyEntity = TransactionHistoryEntity.CreateForSmartVoucherPayment(payment); entity.Campaign = await GetAndUpdateCampaign(context, payment.CampaignId, payment.CampaignName); context.SmartVoucherPayments.Add(entity); context.TransactionHistories.Add(historyEntity); await context.SaveChangesAsync(); } }