Пример #1
0
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     if (!InstallService.NeedToInstall())
     {
         context.Result = this.RedirectToAction("Index", "Home");
     }
     else
     {
         base.OnActionExecuting(context);
     }
 }
Пример #2
0
        public async Task <IActionResult> Index([FromServices] InstallService installService, int page = 1)
        {
            if (installService.NeedToInstall())
            {
                return(RedirectToAction("Index", "Install"));
            }

            var pageSize  = SettingModel.TopicsPerPage;
            var topicList = await TopicService.QueryNotTrash(page, pageSize, Core.Enums.TopicStatus.Published, null);

            var vm = new IndexPageViewModel
            {
                TopicList = new TopicListModel
                {
                    Data      = topicList.Data,
                    PageIndex = page,
                    PageSize  = pageSize,
                    Total     = topicList.Total
                }
            };

            return(View(vm));
        }