コード例 #1
0
        private ActionResult ConfirmAndNextArchivePreservationAttributesConfiguration(ArchiveWizardStepBaseViewModel model)
        {
            short i = 1;
            IDictionary <Guid, short> orderedPreservationAttributes = new Dictionary <Guid, short>();

            foreach (string preservationAttribute in model.SelectedPreservationAttributes)
            {
                orderedPreservationAttributes.Add(Guid.Parse(preservationAttribute), i);
                i++;
            }

            ModifyArchivePreservationAttributesRequestModel requestModel = new ModifyArchivePreservationAttributesRequestModel()
            {
                IdArchive = model.IdArchive,
                OrderedPreservationAttributes = orderedPreservationAttributes
            };
            ModifyArchivePreservationAttributesInteractor interactor = new ModifyArchivePreservationAttributesInteractor(_loggerService);

            interactor.Process(requestModel);

            ArchiveConfigurationWizardViewModel returnModel = new ArchiveConfigurationWizardViewModel()
            {
                IdArchive       = model.IdArchive,
                FlowActiveIndex = 3
            };

            return(View("ArchiveConfigurationWizard", returnModel));
        }
コード例 #2
0
        public ActionResult ArchiveConfigurationWizard(ArchiveWizardStepBaseViewModel model)
        {
            return(ActionResultHelper.TryCatchWithLogger(() =>
            {
                Func <ArchiveWizardStepBaseViewModel, ActionResult> func = null;
                switch (model.ActiveStep)
                {
                case 1:
                    {
                        ModelState.Remove(nameof(ArchiveWizardStepBaseViewModel.SelectedPreservationAttributes));
                        func = (m) => ConfirmAndNextArchivePreservationConfiguration(m);
                    }
                    break;

                case 2:
                    {
                        ModelState.Remove(nameof(ArchiveWizardStepBaseViewModel.MainDateAttribute));
                        ModelState.Remove(nameof(ArchiveWizardStepBaseViewModel.PathPreservation));
                        ModelState.Remove(nameof(ArchiveWizardStepBaseViewModel.SelectedPrimaryKeyAttributes));
                        func = (m) => ConfirmAndNextArchivePreservationAttributesConfiguration(m);
                    }
                    break;

                case 3:
                    {
                        ModelState.Clear();
                        ArchiveConfigurationWizardViewModel returnModel = new ArchiveConfigurationWizardViewModel()
                        {
                            IdArchive = model.IdArchive,
                            FlowActiveIndex = 4,
                            IsCompleteWithErrors = model.IsCompleteWithErrors.Value
                        };
                        return View(returnModel);
                    }

                case 4:
                    {
                        return RedirectToAction("PreservationArchivesConfigurable", "Archive");
                    }

                default:
                    throw new Exception($"Step {model.ActiveStep} not valid");
                }

                if (!ModelState.IsValid)
                {
                    ArchiveConfigurationWizardViewModel resultModel = new ArchiveConfigurationWizardViewModel()
                    {
                        IdArchive = model.IdArchive,
                        FlowActiveIndex = model.ActiveStep
                    };
                    return View(resultModel);
                }

                return func(model);
            }, _loggerService));
        }
コード例 #3
0
        public ActionResult ArchiveConfigurationWizard(Guid id)
        {
            return(ActionResultHelper.TryCatchWithLogger(() =>
            {
                DocumentArchive archive = ArchiveService.GetArchive(id);
                if (archive == null)
                {
                    throw new Exception(string.Format("Nessun archivio trovato con id {0}", id));
                }

                ArchiveConfigurationWizardViewModel model = new ArchiveConfigurationWizardViewModel()
                {
                    IdArchive = id
                };
                return View(model);
            }, _loggerService));
        }