예제 #1
0
        protected IList<SelectListItem> PrepareSelectList(IBranchOfficeService officeService, ICacheManager cacheManager,
            PublishingStatus status = PublishingStatus.Active)
        {
            string cacheKey = ModelCacheEventUser.OFFICE_MODEL_KEY.FormatWith(
                "SelectList.{0}".FormatWith(status.ToString()));

            var cacheModel = cacheManager.Get(cacheKey, () =>
            {
                var offices = officeService.GetAll(status)
                    .Select(office =>
                    {
                        return new SelectListItem()
                        {
                            Value = office.RowId.ToString(),
                            Text = office.BranchName
                        };
                    })
                    .ToList();

                return offices;
            });

            return cacheModel;
        }