예제 #1
0
        public async Task <List <Permission> > RetrieveAsync(PermissionQueryParameter param)
        {
            Expression <Func <Permission, bool> > query = null;

            if (param == null && param.Code != null && param.Name != null)
            {
                query = e => e.Code.StartsWith(param.Code) && e.Title.StartsWith(param.Name);
            }
            else if (param == null && param.Code != null)
            {
                query = e => e.Code.StartsWith(param.Code);
            }
            else if (param == null && param.Name != null)
            {
                query = e => e.Title.StartsWith(param.Name);
            }
            else
            {
                query = e => true;
            }

            var list = (await base.SelectAsync(query)).ToList();

            return(list);
        }
예제 #2
0
        public async Task <IPaged <Permission> > PagedAsync(PermissionQueryParameter param, int pageIndex, int pageSize)
        {
            Expression <Func <Permission, bool> > query = null;

            if (param == null && param.Code != null && param.Name != null)
            {
                query = e => e.Code.StartsWith(param.Code) && e.Title.StartsWith(param.Name);
            }
            else if (param == null && param.Code != null)
            {
                query = e => e.Code.StartsWith(param.Code);
            }
            else if (param == null && param.Name != null)
            {
                query = e => e.Title.StartsWith(param.Name);
            }
            else
            {
                query = e => true;
            }

            return(await base.PagedAsync(query, pageIndex, pageSize));
        }