Ejemplo n.º 1
0
        public List <Transfer> GetAccountTransfers(AccountNumberTemplate accountNumber, bool getFrom = true, bool getTo = true)
        {
            var transfers = new List <Transfer>();

            if (getFrom)
            {
                foreach (var transfer in _transferRepository.GetAccountTransfersFrom(accountNumber.AccountNumber.Value, accountNumber.SubNo, accountNumber.ShredNo))
                {
                    //We are taking away from this account, so the amount is negative
                    var fromTransfer = Transfer.MapFromEntity(transfer);
                    fromTransfer.Amount *= -1;

                    transfers.Add(fromTransfer);
                }
            }

            if (getTo)
            {
                foreach (var transfer in _transferRepository.GetAccountTransfersTo(accountNumber.AccountNumber.Value, accountNumber.SubNo, accountNumber.ShredNo))
                {
                    transfers.Add(Transfer.MapFromEntity(transfer));
                }
            }

            return(transfers);
        }