Пример #1
0
        public IActionResult RebuildParticipants(InputModels.Continue input)
        {
            if (string.IsNullOrEmpty(input.Stage))
            {
                var totalSteps = MessageRepository.RebuildParticipants();

                input = new InputModels.Continue {
                    Stage       = nameof(MessageRepository.RebuildParticipants),
                    CurrentStep = -1,
                    TotalSteps  = totalSteps
                };
            }
            else
            {
                MessageRepository.RebuildParticipantsContinue(input);
            }

            var viewModel = new ViewModels.Delay {
                ActionName  = "Rebuilding participants",
                CurrentPage = input.CurrentStep,
                TotalPages  = input.TotalSteps,
                NextAction  = UrlHelper.Action(nameof(Messages.Admin), nameof(Messages))
            };

            if (input.CurrentStep < input.TotalSteps)
            {
                input.CurrentStep++;
                viewModel.NextAction = UrlHelper.Action(nameof(Messages.RebuildParticipants), nameof(Messages), input);
            }

            return(ForumViewResult.ViewResult(this, "Delay", viewModel));
        }
Пример #2
0
        public async Task <IActionResult> ReprocessMessages(InputModels.Continue input)
        {
            if (string.IsNullOrEmpty(input.Stage))
            {
                var totalSteps = MessageRepository.ReprocessMessages();

                input = new InputModels.Continue {
                    Stage       = nameof(MessageRepository.ReprocessMessages),
                    CurrentStep = -1,
                    TotalSteps  = totalSteps
                };
            }
            else
            {
                await MessageRepository.ReprocessMessagesContinue(input);
            }

            var viewModel = new ViewModels.Delay {
                ActionName  = "Reprocessing Messages",
                ActionNote  = "Processing message text, loading external sites, replacing smiley codes.",
                CurrentPage = input.CurrentStep,
                TotalPages  = input.TotalSteps,
                NextAction  = UrlHelper.Action(nameof(Messages.Admin), nameof(Messages))
            };

            if (input.CurrentStep < input.TotalSteps)
            {
                input.CurrentStep++;
                viewModel.NextAction = UrlHelper.Action(nameof(Messages.ReprocessMessages), nameof(Messages), input);
            }

            return(ForumViewResult.ViewResult(this, "Delay", viewModel));
        }
Пример #3
0
        public async Task <IActionResult> RecountReplies(InputModels.Continue input)
        {
            if (string.IsNullOrEmpty(input.Stage))
            {
                var totalSteps = await MessageRepository.RecountReplies();

                input = new InputModels.Continue {
                    Stage       = nameof(MessageRepository.RecountReplies),
                    CurrentStep = -1,
                    TotalSteps  = totalSteps
                };
            }
            else
            {
                await MessageRepository.RecountRepliesContinue(input);
            }

            var viewModel = new ViewModels.Delay {
                ActionName  = "Recounting Replies",
                CurrentPage = input.CurrentStep,
                TotalPages  = input.TotalSteps,
                NextAction  = UrlHelper.Action(nameof(Messages.Admin), nameof(Messages))
            };

            if (input.CurrentStep < input.TotalSteps)
            {
                input.CurrentStep++;
                viewModel.NextAction = UrlHelper.Action(nameof(Messages.RecountReplies), nameof(Messages), input);
            }

            return(await ForumViewResult.ViewResult(this, "Delay", viewModel));
        }
Пример #4
0
        public async Task <IActionResult> Process(InputModels.Continue input)
        {
            CheckContext();

            var note = string.Empty;

            switch (input.CurrentStep)
            {
            case 1:
                note = "Roles have been setup.";
                await SetupService.SetupRoles();

                break;

            case 2:
                note = "Admins have been added.";
                await SetupService.SetupAdmins();

                break;

            case 3:
                note = "The first category has been added.";
                SetupService.SetupCategories();
                break;

            case 4:
                note = "The first board has been added.";
                SetupService.SetupBoards();
                break;
            }

            input.CurrentStep++;

            var viewModel = new ViewModels.Delay {
                ActionName  = "Processing",
                ActionNote  = note,
                CurrentPage = input.CurrentStep,
                TotalPages  = input.TotalSteps,
                NextAction  = UrlHelper.Action(nameof(Setup.Process), nameof(Setup), input)
            };

            if (input.CurrentStep > input.TotalSteps)
            {
                viewModel.NextAction = "/";
            }

            return(await ForumViewResult.ViewResult(this, "Delay", viewModel));
        }
Пример #5
0
        public async Task <IActionResult> Initialize()
        {
            CheckContext();

            var totalPages = 4;

            var viewModel = new ViewModels.Delay {
                ActionName  = "Initializing",
                ActionNote  = "Beginning the setup process",
                CurrentPage = 0,
                TotalPages  = totalPages,
                NextAction  = UrlHelper.Action(nameof(Setup.Process), nameof(Setup), new InputModels.Continue {
                    CurrentStep = 1, TotalSteps = totalPages
                })
            };

            return(await ForumViewResult.ViewResult(this, "Delay", viewModel));
        }