public Int32 UpdateBankAccount(BankAccountObject bankAccount)
        {
            try
            {
                if (bankAccount == null)
                {
                    return(-2);
                }

                if (_repository.Count(m => m.CustomerId == bankAccount.CustomerId && m.BankId == bankAccount.BankId && m.AccountName == bankAccount.AccountName && m.AccountNo == bankAccount.AccountNo && (m.BankAccountId != bankAccount.BankAccountId)) > 0)
                {
                    return(-3);
                }

                var bankAccountEntity = ModelCrossMapper.Map <BankAccountObject, BankAccount>(bankAccount);
                if (bankAccountEntity == null || bankAccountEntity.BankAccountId < 1)
                {
                    return(-2);
                }
                _repository.Update(bankAccountEntity);
                _uoWork.SaveChanges();
                return(5);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
                return(-2);
            }
        }
Exemple #2
0
 public int UpdateBankAccount(BankAccountObject bankAccount)
 {
     try
     {
         return(_bankAccountRepository.UpdateBankAccount(bankAccount));
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }