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(); }
public void Add(Account account) { _dbContext.Accounts.Add(account); _dbContext.SaveChanges(); }