コード例 #1
0
ファイル: CurrencyManager.cs プロジェクト: NSBTW/Wallet
        public async Task CreateCurrency(string name, CommissionDto dto)
        {
            var currency = new CurrencyRecord {
                Name = name
            };
            await _context.Currencies.AddAsync(currency);

            await _context.SaveChangesAsync();

            var deposit    = CommissionManager.CreateCommission(currency.Id, dto, OperationType.Deposit);
            var transfer   = CommissionManager.CreateCommission(currency.Id, dto, OperationType.Transfer);
            var withdrawal = CommissionManager.CreateCommission(currency.Id, dto, OperationType.Withdrawal);

            await _context.Commissions.AddRangeAsync(deposit, transfer, withdrawal);

            await _context.SaveChangesAsync();
        }
コード例 #2
0
ファイル: CurrencyManager.cs プロジェクト: NSBTW/Wallet
 public CurrencyManager(WalletContext context, CommissionManager commissionManager)
 {
     _context           = context;
     _commissionManager = commissionManager;
 }