Пример #1
0
 public static GetAccountsResult ToResult(IEnumerable <AccountAggregate> accounts, IEnumerable <AccountAccessConsentPermission> permissions, string self, int totalPages)
 {
     return(new GetAccountsResult(self, totalPages)
     {
         Data = new AccountsResult
         {
             Account = accounts.Select(a => AccountRecordResult.ToResult(a, permissions))
         }
     });
 }
Пример #2
0
        public static AccountRecordResult ToResult(AccountAggregate account, IEnumerable <AccountAccessConsentPermission> permissions)
        {
            var result = new AccountRecordResult
            {
                AccountId            = account.AggregateId,
                AccountSubType       = account.AccountSubType?.Name,
                AccountType          = account.AccountType?.Name,
                Currency             = account.Currency,
                Description          = account.Description,
                MaturityDate         = account.MaturityDate,
                Nickname             = account.Nickname,
                OpeningDate          = account.OpeningDate,
                StatusUpdateDateTime = account.StatusUpdateDateTime,
                SwitchStatus         = account.SwitchStatus?.Name
            };

            if (permissions.Contains(AccountAccessConsentPermission.ReadAccountsDetail))
            {
                result.Servicer = account.Servicer == null ? null : ServicerResult.ToResult(account.Servicer);
                result.Accounts = account.Accounts.Select(a => CashAccountResult.ToResult(a)).ToList();
            }

            return(result);
        }