コード例 #1
0
ファイル: HomeController.cs プロジェクト: yukangsheng/BBS
        public IActionResult Topic()
        {
            TopicListRequest model = new TopicListRequest();

            PrepareCatalog(model);
            return(View(model));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: yukangsheng/BBS
        public IActionResult Topic(TopicListRequest request)
        {
            var list = _context.Topic.WhereIf(x => x.Title.Contains(request.Title), !string.IsNullOrWhiteSpace(request.Title))
                       .WhereIf(x => x.AccountId == request.AccountId, request.AccountId > 0)
                       .WhereIf(x => x.CatalogId == request.CatalogId, request.CatalogId > 0)
                       .WhereIf(x => x.CreateTime >= request.Begin.Value.Date, request.Begin.HasValue)
                       .WhereIf(x => x.CreateTime < request.End.Value.Date.AddDays(1), request.End.HasValue)
                       .OrderByDescending(x => x.Id).ToPagedList <Topic, TopicModel>(request.Page, request.PageSize);

            return(Json(list.ToPageData().Success()));
        }