예제 #1
0
        public ActionResult GetPageData(int page = 1, int size = 10, string kw = "")
        {
            Expression <Func <PostMergeRequest, bool> > where = r => true;
            if (!string.IsNullOrEmpty(kw))
            {
                where = where.And(r => r.Title.Contains(kw) || r.Content.Contains(kw) || r.Modifier.Contains(kw) || r.ModifierEmail.Contains(kw));
            }

            var list      = PostMergeRequestService.LoadEntities(where).OrderBy(d => d.MergeState).ThenByDescending(r => r.Id).Skip((page - 1) * size).Take(size).ProjectTo <PostMergeRequestOutputDtoBase>(MapperConfig).ToList();
            var count     = PostMergeRequestService.Count(where);
            var pageCount = Math.Ceiling(count * 1.0 / size).ToInt32();

            return(PageResult(list, pageCount, count));
        }