Example #1
0
        public static void SaveBankAccount(Data_BankAccount bankAccount)
        {
            try
            {
                using (NewcourtEntities ctx = new NewcourtEntities())
                {
                    BankAccounts record = ctx.BankAccounts.FirstOrDefault(a => a.BankAccountCode == bankAccount.BankAccountCode);

                    if (record != null)
                    {
                        record.BankAccountName = bankAccount.BankAccountName;
                        record.BIC             = bankAccount.BIC;
                        record.IBAN            = bankAccount.IBAN;
                        record.OIN             = bankAccount.OIN;
                    }
                    else
                    {
                        ctx.BankAccounts.Add(new BankAccounts()
                        {
                            BankAccountCode = bankAccount.BankAccountCode,
                            BankAccountName = bankAccount.BankAccountName,
                            BIC             = bankAccount.BIC,
                            IBAN            = bankAccount.IBAN,
                            OIN             = bankAccount.IBAN
                        });
                    }

                    ctx.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public static void DeleteBankAccount(String bankAccountCode)
        {
            try
            {
                using (NewcourtEntities ctx = new NewcourtEntities())
                {
                    BankAccounts record = ctx.BankAccounts.FirstOrDefault(a => a.BankAccountCode == bankAccountCode);

                    if (record != null)
                    {
                        ctx.BankAccounts.Remove(record);
                        ctx.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }