예제 #1
0
        public virtual ActionResult OptionList(int specificationAttributeId, DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes))
            {
                return(AccessDeniedKendoGridJson());
            }

            var options   = _specificationAttributeService.GetSpecificationAttributeOptionsBySpecificationAttribute(specificationAttributeId);
            var gridModel = new DataSourceResult
            {
                Data = options.Select(x =>
                {
                    var model = x.ToModel();
                    //in subscription to save performance to do not check whether a article is deleted, etc
                    model.NumberOfAssociatedArticles = _specificationAttributeService
                                                       .GetArticleSpecificationAttributeCount(0, x.Id);
                    //locales
                    //AddLocales(_languageService, model.Locales, (locale, languageId) =>
                    //{
                    //    locale.Name = x.GetLocalized(y => y.Name, languageId, false, false);
                    //});
                    return(model);
                }),
                Total = options.Count()
            };

            return(Json(gridModel));
        }