public async Task <IActionResult> DeleteQuestionAsync(int id)
        {
            Domain.Questions.Hub questionHub = new Domain.Questions.Hub();
            Resp r = await questionHub.DeleteQuestionAsync(id);

            return(Pack(r));
        }
        public async Task <IActionResult> GetReportQuestionList(int index, int size, string title)
        {
            Paginator pager = Paginator.New(index, size, 1);

            pager["title"] = string.IsNullOrWhiteSpace(title) ? "" : title;

            Domain.Questions.Hub questionHub = new Domain.Questions.Hub();
            var r = await questionHub.GetListAsync(pager, Domain.Questions.Hub.QuestionListSource.Reports);

            return(Pack(r));
        }
        public async Task <IActionResult> GetListAsync(int index, int size, string search, int?state)
        {
            /*
             *  管理员获取的问题列表,不包括被移除的,移除的列表在回收站中查看
             */

            Paginator pager = Paginator.New(index, size, 2);

            pager["search"] = search;
            pager["state"]  = state.ToString();

            Domain.Questions.Hub hub = new Domain.Questions.Hub();
            Resp resp = await hub.GetListAsync(pager, Domain.Questions.Hub.QuestionListSource.Admin);

            return(Pack(resp));
        }
        public async Task <IActionResult> Newest(int index, int size)
        {
            SetTitle("最新提问");

            Domain.Paginator page = Domain.Paginator.New(index, size);

            Domain.Questions.Hub hub = new Domain.Questions.Hub();
            page = await hub.GetNewestQuestionsPager(page);

            NewestModel model = new NewestModel
            {
                Page = page
            };

            return(View("Newest", model));
        }
        public async Task <IActionResult> SearchResult(string s, int index, int size)
        {
            if (string.IsNullOrWhiteSpace(s))
            {
                return(await Newest(0, 0));
            }

            SetTitle(s);

            Domain.Paginator page = Domain.Paginator.New(index, size, 1);
            page["search"] = s;

            Domain.Questions.Hub hub = new Domain.Questions.Hub();
            page = await hub.GetClientQuestionPager(page);

            SearchModel model = new SearchModel
            {
                Search = s,
                Page   = page
            };

            return(View("Search", model));
        }