public ActionResult List(DataTablesParam dataTableParam) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog)) { return(AccessDeniedView()); } var extendedAttributes = _extendedAttributeService.GetAllExtendedAttributes(true); var total = extendedAttributes.Count(); var result = new DataTablesData { iTotalRecords = total, iTotalDisplayRecords = total, sEcho = dataTableParam.sEcho, aaData = extendedAttributes.Select(x => { var caModel = x.ToModel(); caModel.AttributeControlTypeName = x.AttributeControlType.GetLocalizedEnum(_localizationService, _workContext); return(caModel); }).Cast <object>().ToArray(), }; return(new JsonResult { Data = result }); }
private void PrepareChannelModel(ChannelModel model, Channel cannel, bool excludeProperties) { var extendeds = new List <ExtendedAttribute>(); if (cannel != null) { var result = new StringBuilder(); extendeds = cannel.ExtendedAttributes.ToList(); for (int i = 0; i < cannel.ExtendedAttributes.Count; i++) { var pt = extendeds[i]; result.Append(pt.Id); if (i != cannel.ExtendedAttributes.Count - 1) { result.Append(", "); } } model.ExtendedAttributes = result.ToString(); } var allExtended = _extendedAttributeService.GetAllExtendedAttributes(); foreach (var extended in allExtended) { model.AvailableExtendedAttributes.Add(new SelectListItem() { Text = extended.Title, Value = extended.Id.ToString(), Selected = extendeds.Where(e => e.Id == extended.Id).Any() }); } }