Exemplo n.º 1
0
        public PartialViewResult GetRoleInfoData(int page = 1, string type = "", string searchContext = "")
        {
            int total;
            IEnumerable <RoleInfo> result = null;

            if (type != "" && searchContext != "")
            {
                result = Search(type, searchContext);
                result =
                    result.OrderBy(p => p.RoleName)
                    .Skip((page - 1) * PageSize)
                    .Take(PageSize);
                total = result.Count();
            }
            else
            {
                result = roleInfoService.GetPageEntites(PageSize, page, out total,
                                                        u => u.DelFlag == (short)DelFlagEnum.Normal, u => u.RoleName, true);
            }

            RoleInfoViewModel model = new RoleInfoViewModel
            {
                RoleInfos  = result,
                PagingInfo = new PagingInfo {
                    CurrentPage = page, ItemsPerPage = PageSize, TotalItems = total
                }
            };

            return(PartialView(model));
        }