public ActionResult JsonSuccessGenericPageExecResult <T>(GenericPageResult <T> pageResult, string message = "") { GenericExecResult <GenericPageResult <T> > execResult = new GenericExecResult <GenericPageResult <T> >() { Success = true, Message = message, Data = pageResult }; return(ResponseJson(execResult)); }
public GenericPageResult <T> Page <T>(IOrderByGetter orderByGetter, IWhereGetter where, int pageIndex = 1, int pageSize = 10) where T : class { var iCriteria = this.Session.CreateCriteria <T>(); pageIndex = pageIndex == 0 ? 1 : pageIndex; iCriteria = QueryParameterHelper.Add(iCriteria, where); var total = ICriteriaHelper.Count(iCriteria); iCriteria.SetMaxResults(pageSize); iCriteria.SetFirstResult(pageSize * (pageIndex - 1)); iCriteria = QueryParameterHelper.AddOrder(iCriteria, orderByGetter.OrderBys); var list = iCriteria.List <T>(); GenericPageResult <T> resultData = new GenericPageResult <T>() { Data = list, PageIndex = pageIndex, PageSize = pageSize, Total = total }; return(resultData); }