コード例 #1
0
        public ActionResult Index()
        {
            var model = new AccountCodeViewModel();

            var accountCodes = new List <AccountCodeViewModel>();

            var tempCodes = _accountCodeRepository.GetAccountCodes();

            foreach (var tempCode in tempCodes)
            {
                AccountCodeViewModel convertedModel = new AccountCodeConverter().ConvertToView(tempCode);

                accountCodes.Add(convertedModel);
            }

            model.AccountCodes = accountCodes.OrderBy(x => x.Description).ToList();

            model.SelectableCustomers = _customerDynamicsRepository.GetSelectableCustomers();

            var defaultCustomer = new SelectListItem()
            {
                Text  = "--Select Customer--",
                Value = null
            };

            model.SelectableCustomers.Insert(0, defaultCustomer);

            model.SelectableBuckets = _bucketRepository.GetSelectableBuckets();

            return(View(model));
        }