Ejemplo n.º 1
0
 public void Create(Bank bank)
 {
     using (var context = new Persondb2Context())
     {
         try
         {
             context.Add(bank);
             context.SaveChanges();
         }
         catch (Exception ex)
         {
             throw new NotImplementedException($"{ex.Message}\n{ex.InnerException.Message} \nXXX");
         }
     }
 }
Ejemplo n.º 2
0
        public void AddTransaction(Transaction transaction)
        {
            using (var context = new Persondb2Context())
            {
                try
                {
                    context.Add(transaction);
                    var account = GetAccountByIban(transaction.Iban);
                    account.Balance += transaction.Amount;

                    context.Account.Update(account);
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw new NotImplementedException($"{ex.Message}\n{ex.InnerException.Message} \n");
                }
            }
        }