public IHttpActionResult GetPages(string storeId, [FromUri] GetPagesCriteria criteria)
        {
            base.CheckCurrentUserHasPermissionForObjects(ContentPredefinedPermissions.Read, new ContentScopeObject {
                StoreId = storeId
            });
            var items = _pagesService.GetPages(storeId, criteria.ToCoreModel()).Select(s => s.ToWebModel());

            return(Ok(items));
        }
        public IHttpActionResult SyncAssets(string storeId, string theme, DateTime?themeUpdated, DateTime?pagesUpdated)
        {
            var themeItems = this._themeService.GetThemeAssets(storeId, theme, new GetThemeAssetsCriteria()
            {
                LoadContent = true, LastUpdateDate = themeUpdated
            });
            var pageItems = _pagesService.GetPages(storeId, new GetPagesCriteria()
            {
                LastUpdateDate = pagesUpdated
            }).Select(s => s.ToWebModel());

            var themeGroup = new SyncAssetGroup {
                Type = "theme", Assets = themeItems.Select(s => s.ToWebModel()).Select(x => x.ToSyncModel()).OrderBy(x => x.Updated).ToArray()
            };
            var pageGroup = new SyncAssetGroup {
                Type = "pages", Assets = pageItems.Select(x => x.ToSyncModel()).OrderBy(x => x.Updated).ToArray()
            };

            return(Ok(new [] { themeGroup, pageGroup }));
        }
        private BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback, bool handleBynaryData)
        {
            var progressInfo = new ExportImportProgressInfo();

            progressInfo.Description = "cms content loading...";
            progressCallback(progressInfo);

            var stores        = _storeService.GetStoreList();
            var menuLinkLists = new List <MenuLinkList>();
            var contentItems  = new List <coreModels.ThemeAsset>();
            var contentPages  = new List <coreModels.Page>();

            foreach (var store in stores)
            {
                var storeLists = _menuService.GetListsByStoreId(store.Id);
                menuLinkLists.AddRange(storeLists.Select(s => ConvertToExportModel(s)));

                if (handleBynaryData)
                {
                    var storePages = _pagesService.GetPages(store.Id, null);
                    contentPages.AddRange(storePages);

                    var storeThemes = _themeService.GetThemes(store.Id).ToArray();
                    foreach (var storeTheme in storeThemes)
                    {
                        var themeContentItems = _themeService.GetThemeAssets(store.Id, storeTheme.Name, null).ToArray();
                        contentItems.AddRange(themeContentItems);
                    }
                }
            }

            return(new BackupObject
            {
                MenuLinkLists = menuLinkLists,
                ThemeAssets = contentItems,
                Pages = contentPages
            });
        }
Example #4
0
        public IHttpActionResult GetPages(string storeId, [FromUri] GetPagesCriteria criteria)
        {
            var items = _pagesService.GetPages(storeId, criteria.ToCoreModel()).Select(s => s.ToWebModel());

            return(Ok(items));
        }