public IHttpActionResult GetDynamicContentPlaceById(string id) { var retVal = _dynamicContentService.GetPlaceById(id); if (retVal != null) { return(Ok(retVal.ToWebModel())); } return(NotFound()); }
private void SearchContentPlaces(coreModel.MarketingSearchCriteria criteria, coreModel.MarketingSearchResult result) { using (var repository = _repositoryFactory()) { var query = repository.Places.Where(x => x.FolderId == criteria.FolderId); result.TotalCount += query.Count(); var ids = query.OrderBy(x => x.Id) .Select(x => x.Id) .Skip(criteria.Start) .Take(criteria.Count).ToArray(); result.ContentPlaces = ids.Select(x => _dynamicContentService.GetPlaceById(x)).ToList(); } }
private BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback) { var result = new BackupObject(); var progressInfo = new ExportImportProgressInfo { Description = "Search promotions..." }; progressCallback(progressInfo); var allPromotions = _marketingSearchService.SearchResources(new MarketingSearchCriteria { Count = int.MaxValue, ResponseGroup = SearchResponseGroup.WithPromotions }).Promotions; progressInfo.Description = String.Format("{0} promotions loading...", allPromotions.Count()); progressCallback(progressInfo); result.Promotions = allPromotions.Select(x => _promotionService.GetPromotionById(x.Id)).ToList(); progressInfo.Description = "Search dynamic content objects..."; progressCallback(progressInfo); var searchResult = SearchInFolder(null); var allFolderSearchResults = searchResult != null?searchResult.Traverse(ChildrenForFolder).ToArray() : null; if (allFolderSearchResults != null) { progressInfo.Description = String.Format("Loading folders..."); progressCallback(progressInfo); result.ContentFolders = allFolderSearchResults.SelectMany(x => x.ContentFolders).ToList(); progressInfo.Description = String.Format("Loading places..."); progressCallback(progressInfo); result.ContentPlaces = allFolderSearchResults.SelectMany(x => x.ContentPlaces) .Select(x => _dynamicContentService.GetPlaceById(x.Id)) .ToList(); progressInfo.Description = String.Format("Loading contents..."); progressCallback(progressInfo); result.ContentItems = allFolderSearchResults.SelectMany(x => x.ContentItems) .Select(x => _dynamicContentService.GetContentItemById(x.Id)) .ToList(); progressInfo.Description = String.Format("Loading publications..."); progressCallback(progressInfo); result.ContentPublications = allFolderSearchResults.SelectMany(x => x.ContentPublications) .Select(x => _dynamicContentService.GetPublicationById(x.Id)) .ToList(); } return(result); }