コード例 #1
0
        public ActionResult Index(CorporateAccountListModelFilter filter = null, int pageNumber = 1)
        {
            int totalRecords;
            var model = _organizationService.GetCorporateAccountListModel(pageNumber, PAGE_SIZE, filter, out totalRecords);

            if (model == null)
            {
                model = new CorporateAccountListModel();
            }
            model.Filter = filter;

            var currentAction          = ControllerContext.RouteData.Values["action"].ToString();
            Func <int, string> urlFunc = pn => Url.Action(currentAction, new { pageNumber = pn, filter.Name, filter.ShowHealthPlanOnly, filter.ShowCorporateAccountOnly });

            model.PagingModel = new PagingModel(pageNumber, PAGE_SIZE, totalRecords, urlFunc);
            return(View(model));
        }
コード例 #2
0
        public CorporateAccountListModel Create(IEnumerable <CorporateAccount> accounts, IEnumerable <OrderedPair <long, string> > accountIdPackagesPair, OrganizationListModel orgListModel)
        {
            var model       = new CorporateAccountListModel();
            var basicModels = new CorporateAccountModel[accounts.Count()];
            var index       = 0;

            foreach (var account in accounts)
            {
                basicModels[index++] = new CorporateAccountModel
                {
                    ContractNotes   = account.ContractNotes,
                    DefaultPackages = accountIdPackagesPair != null?accountIdPackagesPair.Where(ap => ap.FirstValue == account.Id).Select(ap => ap.SecondValue).ToArray() : null,
                                          OrganizationBasicInfoModel = orgListModel.Organizations.FirstOrDefault(o => o.Id == account.Id),
                                          IsHealthPlan = account.IsHealthPlan
                };
            }
            model.CorporateAccounts = basicModels;
            return(model);
        }