예제 #1
0
        private List <RecycleItem> GetRecycleItems()
        {
            var pages        = _pageRepository.GetDeletedPages();
            var layouts      = _layoutRepository.GetDeletedLayouts();
            var pageContents = _pageContentRepository.GetDeletedPageContents();
            var pageModules  = _pageRepository.GetDeletedPageModules();

            var recycleItems        = new List <RecycleItem>();
            var allRecycleItemTypes = RecycleItemType.GetRecycleItemTypes();

            if (layouts != null && layouts.Count > 0)
            {
                recycleItems.AddRange(layouts.Select(layout => new RecycleItem()
                {
                    Id              = layout.Id,
                    Name            = layout.Name,
                    RecycleItemType = allRecycleItemTypes.First(rt => rt.Name == "Layouts")
                }));
            }

            if (pages != null && pages.Count > 0)
            {
                recycleItems.AddRange(pages.Select(page => new RecycleItem()
                {
                    Id              = page.Id,
                    Name            = page.PageTranslation.FirstOrDefault()?.Name,
                    RecycleItemType = allRecycleItemTypes.First(rt => rt.Name == "Page")
                }));
            }

            if (pageContents != null && pageContents.Count > 0)
            {
                recycleItems.AddRange(pageContents.Select(pc => new RecycleItem()
                {
                    Id              = pc.Id,
                    Name            = pc.Title,
                    RecycleItemType = allRecycleItemTypes.First(rt => rt.Name == "PageContent")
                }));
            }

            if (pageModules != null && pageModules.Count > 0)
            {
                recycleItems.AddRange(pageModules.Select(pm => new RecycleItem()
                {
                    Id = pm.Id, Name = pm.Title, RecycleItemType = allRecycleItemTypes.First(rt => rt.Name == "PageModule")
                }));
            }

            return(recycleItems);
        }
        public List <PageContent> GetDeletedPageContents()
        {
            var result = _pageContentRepository.GetDeletedPageContents();

            return(result);
        }