Esempio n. 1
0
        private GridDefinition GetGridModel()
        {
            return(new GridDefinition {
                InitialPageSize = 20,
                ModuleGuid = Module.ModuleGuid,
                SettingsModuleGuid = Module.PermanentGuid,
                RecordType = typeof(BrowseItem),
                AjaxUrl = GetActionUrl(nameof(AddonsBrowse_GridData)),
                SortFilterStaticData = (List <object> data, int skip, int take, List <DataProviderSortInfo> sorts, List <DataProviderFilterInfo> filters) => {
                    DataProviderGetRecords <BrowseItem> recs = DataProviderImpl <BrowseItem> .GetRecords(data, skip, take, sorts, filters);

                    foreach (BrowseItem r in recs.Data)
                    {
                        r.Module = Module;
                    }
                    return new DataSourceResult {
                        Data = recs.Data.ToList <object>(),
                        Total = recs.Total,
                    };
                },
                DirectDataAsync = (int skip, int take, List <DataProviderSortInfo> sort, List <DataProviderFilterInfo> filters) => {
                    List <VersionManager.AddOnProduct> list = VersionManager.GetAvailableAddOns();
                    DataSourceResult data = new DataSourceResult {
                        Data = (from l in list select new BrowseItem(Module, l)).ToList <object>(),
                        Total = list.Count,
                    };
                    return Task.FromResult(data);
                },
            });
        }
Esempio n. 2
0
        public ActionResult AddonDisplay(string key)
        {
            List <VersionManager.AddOnProduct> list = VersionManager.GetAvailableAddOns();

            VersionManager.AddOnProduct data = (from l in list where l.AddonKey == key select l).FirstOrDefault();
            if (data == null)
            {
                throw new Error(this.__ResStr("notFound", "AddOn Info for key \"{0}\" not found"), key);
            }
            DisplayModel model = new DisplayModel();

            model.SetData(data);
            return(View(model));
        }