Exemplo n.º 1
0
        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 IEnumerable <ContentPage> GetPages(string path, GetPagesCriteria criteria)
        {
            var query = Pages.Where(p => p.Path.StartsWith(path));

            if (criteria != null && criteria.LastUpdateDate.HasValue)
            {
                query = query.Where(i => (i.ModifiedDate.HasValue && criteria.LastUpdateDate.Value < i.ModifiedDate.Value) || (criteria.LastUpdateDate.Value < i.CreatedDate));
            }

            return(query.AsEnumerable());
        }
Exemplo n.º 3
0
        public IEnumerable <Models.Page> GetPages(string storeId, GetPagesCriteria criteria)
        {
            var path  = string.Format("{0}/", storeId);
            var pages = _repository.GetPages(path, criteria);

            foreach (var page in pages)
            {
                page.Path        = FixPath(GetPageMainPath(storeId, page.Language), page.Path);
                page.ContentType = ContentTypeUtility.GetContentType(page.Name, page.ByteContent);
            }

            return(pages.Select(p => p.AsPage()));
        }
        public IEnumerable <Models.ContentPage> GetPages(string path, GetPagesCriteria criteria)
        {
            var list = new List <Models.ContentPage>();

            var retVal = new List <Models.ContentPage>();

            var fullPath = GetFullPath(path);

            if (!Directory.Exists(fullPath))
            {
                Directory.CreateDirectory(fullPath);
            }

            var languages = Directory.GetDirectories(fullPath);

            foreach (var language in languages)
            {
                var files = Directory.GetFiles(language, "*.*", SearchOption.AllDirectories);

                foreach (var file in files)
                {
                    var addedPage = new Models.ContentPage
                    {
                        Name         = FixName(file, language),
                        ModifiedDate = Directory.GetLastWriteTimeUtc(file),
                        Language     = GetLanguageFromLanguagePath(language),
                        ByteContent  = File.ReadAllBytes(file),
                        ContentType  = ContentTypeUtility.GetContentType(Path.GetFileName(file), File.ReadAllBytes(file)),
                        Path         = RemoveBaseDirectory(file),
                        Id           = RemoveBaseDirectory(file)
                    };

                    list.Add(addedPage);
                }
            }

            return(list.ToArray());
        }
Exemplo n.º 5
0
 public IEnumerable <ContentPage> GetPages(string path, GetPagesCriteria criteria)
 {
     return(GetPages(path));
 }
 public IEnumerable <ContentPage> GetPages(string path, GetPagesCriteria criteria)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
        public IHttpActionResult GetPages(string storeId, [FromUri] GetPagesCriteria criteria)
        {
            var items = _pagesService.GetPages(storeId, criteria.ToCoreModel()).Select(s => s.ToWebModel());

            return(Ok(items));
        }