Esempio n. 1
0
        public CorporateAccountListModel GetCorporateAccountListModel(int pageNumber, int pageSize, CorporateAccountListModelFilter filter, out int totalRecords)
        {
            var accounts = _corporateAccountRepository.GetbyFilter(pageNumber, pageSize, filter, out totalRecords);

            if (accounts.IsNullOrEmpty())
            {
                return(null);
            }

            var accountIds            = accounts.Select(a => a.Id).ToArray();
            var accountIdPackagesPair =
                _corporateAccountRepository.GetAccountIdPackagesNamePair(accountIds);

            var organizations = _organizationRepository.GetOrganizations(accountIds);
            var orgListModels = GetOrganizationListModel(organizations);

            return(_corporateAccountListModelFactory.Create(accounts, accountIdPackagesPair, orgListModels));
        }