示例#1
0
        public ActionResult IncrementalPublishQueue()
        {
            // Get report data
            ReportService reportService = new ReportService();
            IEnumerable <PublishQueueItem> reportData = reportService.IncrementalPublishQueue_GetData();

            // Build viewmodel
            PublishQueueViewModel viewModel = new PublishQueueViewModel();

            if (reportData != null)
            {
                viewModel.MapToViewModel(reportData);
            }

            return(View("~/Views/SPRK/Report/IncrementalPublishQueue.cshtml", viewModel));
        }
示例#2
0
        /// <summary>
        /// Populates a PublishQueueViewModel by mapping the related objects to it.
        /// </summary>
        /// <param name="vm">View model to be mapped.</param>
        /// <param name="candidateItems">Enumerable list of PublishingCandidate items from the PublishQueue class.</param>
        public static void MapToViewModel(this PublishQueueViewModel vm, IEnumerable <PublishQueueItem> candidateItems)
        {
            if (candidateItems == null)
            {
                return;
            }

            foreach (PublishQueueItem candidate in candidateItems)
            {
                vm.CandidateItems.Add(new PublishQueueItemViewModel()
                {
                    ItemID         = $"{{{candidate.ItemID.ToString().ToUpper()}}}",
                    Language       = candidate.Language,
                    ItemName       = candidate.ItemName,
                    SourceDatabase = candidate.SourceDatabase,
                    Targetdatabase = candidate.TargetDatabase
                });
            }
        }