public override void OnActionExecuting(ActionExecutingContext context) { if (!InstallService.NeedToInstall()) { context.Result = this.RedirectToAction("Index", "Home"); } else { base.OnActionExecuting(context); } }
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)); }