예제 #1
0
파일: Setup.cs 프로젝트: Smilefounder/forum
        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));
        }