コード例 #1
0
        public MultistepActionStepResult Step(int step)
        {
            var content  = ContentRepository.GetById(ContentId);
            var settings = HttpContext.Session.GetValue <ExportSettings>(HttpContextSession.ExportSettingsSessionKey);

            Ensure.NotNull(content, string.Format(ContentStrings.ContentNotFound, ContentId));
            Ensure.NotNull(settings);
            var extContents = ExtensionContentIds != null && ExtensionContentIds.Any() ? ContentRepository.GetList(ExtensionContentIds) : new Content[] { };

            var csv    = new CsvWriter(SiteId, ContentId, Ids, extContents, settings);
            var result = new MultistepActionStepResult {
                ProcessedItemsCount = csv.Write(step, ItemsPerStep)
            };

            HttpContext.Session.SetValue(HttpContextSession.ExportSettingsSessionKey, settings);

            if (csv.CsvReady)
            {
                result.AdditionalInfo = csv.CopyFileToTempUploadDirectory();
            }

            return(result);
        }