public IHttpActionResult DynamicContentPublicationsSearch(DynamicContentPublicationSearchCriteria criteria) { var retVal = new GenericSearchResult <webModel.DynamicContentPublication>(); var publicationSearchResult = _dynamicConentSearchService.SearchContentPublications(criteria); retVal.TotalCount = publicationSearchResult.TotalCount; retVal.Results = publicationSearchResult.Results.Select(x => x.ToWebModel()).ToList(); return(Ok(retVal)); }
private BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback) { var result = new BackupObject(); var progressInfo = new ExportImportProgressInfo { Description = "Search promotions..." }; progressCallback(progressInfo); var allPromotions = _promotionSearchService.SearchPromotions(new Domain.Marketing.Model.Promotions.Search.PromotionSearchCriteria { Take = int.MaxValue }).Results; progressInfo.Description = String.Format("{0} promotions loading...", allPromotions.Count()); progressCallback(progressInfo); result.Promotions = _promotionService.GetPromotionsByIds(allPromotions.Select(x => x.Id).ToArray()); progressInfo.Description = "Search dynamic content objects..."; progressCallback(progressInfo); progressInfo.Description = String.Format("Loading folders..."); progressCallback(progressInfo); result.ContentFolders = LoadFoldersRecursive(null); progressInfo.Description = String.Format("Loading places..."); progressCallback(progressInfo); result.ContentPlaces = _dynamicContentSearchService.SearchContentPlaces(new DynamicContentPlaceSearchCriteria { Take = int.MaxValue }).Results.ToList(); progressInfo.Description = String.Format("Loading contents..."); progressCallback(progressInfo); result.ContentItems = _dynamicContentSearchService.SearchContentItems(new DynamicContentItemSearchCriteria { Take = int.MaxValue }).Results.ToList(); progressInfo.Description = String.Format("Loading publications..."); progressCallback(progressInfo); result.ContentPublications = _dynamicContentSearchService.SearchContentPublications(new DynamicContentPublicationSearchCriteria { Take = int.MaxValue }).Results.ToList(); progressInfo.Description = String.Format("Loading coupons..."); progressCallback(progressInfo); var couponsTotal = _couponService.SearchCoupons(new CouponSearchCriteria { Take = 0 }).TotalCount; var pageSize = 500; Paginate(couponsTotal, pageSize, (x) => { progressInfo.Description = String.Format($"Loading coupons: {Math.Min(x * pageSize, couponsTotal)} of {couponsTotal} loaded"); progressCallback(progressInfo); result.Coupons.AddRange(_couponService.SearchCoupons(new CouponSearchCriteria { Skip = (x - 1) * pageSize, Take = pageSize }).Results); }); progressInfo.Description = String.Format("Loading usages..."); progressCallback(progressInfo); var usagesTotal = _usageService.SearchUsages(new PromotionUsageSearchCriteria { Take = 0 }).TotalCount; Paginate(usagesTotal, pageSize, (x) => { progressInfo.Description = String.Format($"Loading usages: {Math.Min(x * pageSize, usagesTotal)} of {usagesTotal} loaded"); progressCallback(progressInfo); result.Usages.AddRange(_usageService.SearchUsages(new PromotionUsageSearchCriteria { Skip = (x - 1) * pageSize, Take = pageSize }).Results); }); return(result); }
protected virtual GenericSearchResult <DynamicContentPublication> LoadContentPublications(DynamicContentPublicationSearchCriteria criteria) { return(_dynamicContentSearchService.SearchContentPublications(criteria)); }