コード例 #1
0
        public void Add(Transaction transaction)
        {
            if (string.IsNullOrEmpty(transaction.PayeeName) == false)
            {
                if (_dbContext.Payees.SingleOrDefault(p => p.Name == transaction.PayeeName) == null)
                {
                    _dbContext.Payees.Add(new Payee {
                        Name = transaction.PayeeName
                    });
                }
            }

            _dbContext.Transactions.Add(transaction);
            _dbContext.SaveChanges();
        }
コード例 #2
0
 public void Add(Account account)
 {
     _dbContext.Accounts.Add(account);
     _dbContext.SaveChanges();
 }