Exemplo n.º 1
0
 public Transaction GetTransaction(Guid id)
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         return(context.Transaction.SingleOrDefault(o => o.Id == id));
     }
 }
Exemplo n.º 2
0
 public BankAccount GetBankAccount(Guid id)
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         return(context.BankAccount.SingleOrDefault(o => o.Id == id));
     }
 }
Exemplo n.º 3
0
 public ICollection <Transaction> GetTransactions()
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         return(context.Transaction.ToList());
     }
 }
Exemplo n.º 4
0
 public ICollection <BankAccount> GetBankAccounts()
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         return(context.BankAccount.ToList());
     }
 }
Exemplo n.º 5
0
 public void UpdateTransaction(Transaction bankAccount)
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         context.Transaction.Update(bankAccount);
         context.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public void UpdateBankAccount(BankAccount bankAccount)
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         context.BankAccount.Update(bankAccount);
         context.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void DeleteTransaction(Guid id)
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         var transaction = GetTransaction(id);
         context.Transaction.Remove(transaction);
         context.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public void DeleteBankAccount(Guid id)
 {
     using (var context = new WebWalletApiContext(_optionsBuilder.Options))
     {
         var bankAccount = GetBankAccount(id);
         context.BankAccount.Remove(bankAccount);
         context.SaveChanges();
     }
 }
Exemplo n.º 9
0
 public BankAccountRepository(WebWalletApiContext context) : base(context)
 {
 }
Exemplo n.º 10
0
 public UnitOfWork(WebWalletApiContext context)
 {
     _context     = context;
     BankAccounts = new BankAccountRepository(_context);
     Transactions = new TransactionRepository(_context);
 }