コード例 #1
0
ファイル: RoleService.cs プロジェクト: AliBelyani/Source
        public async Task <PagingResult <TViewModel> > GetsAsync <TViewModel>(bool NeedDBCount, RoleSearchParameter xParameters = null)
        {
            if (xParameters == null)
            {
                xParameters = new RoleSearchParameter();
            }
            #region OrderBy
            Func <IQueryable <Role>, IOrderedQueryable <Role> > xOrderBy = p => p.OrderByDescending(x => x.Id);
            if (xParameters.xSortBy == "xName")
            {
                if (xParameters.xSortType == "Des")
                {
                    xOrderBy = p => p.OrderByDescending(x => x.Name);
                }
                else
                {
                    xOrderBy = p => p.OrderBy(x => x.Name);
                }
            }
            else if (xParameters.xSortBy == "xDescription")
            {
                if (xParameters.xSortType == "Des")
                {
                    xOrderBy = p => p.OrderByDescending(x => x.xDescription);
                }
                else
                {
                    xOrderBy = p => p.OrderBy(x => x.xDescription);
                }
            }

            #endregion

            #region Filter
            Expression <Func <Role, bool> > xFilter = p =>
                                                      (xParameters.xName == "" || xParameters.xName == null || p.Name.Trim().ToLower().Contains(xParameters.xName.Trim().ToLower()));


            #endregion

            return(await uow.RoleRepository.GetAsync <TViewModel>(NeedDBCount, xFilter, xOrderBy, xParameters.xPage, xParameters.xPageSize));
        }
コード例 #2
0
 public JsonResult Search(RoleSearchParameter parameter)
 {
     return(Json(""));
 }