Beispiel #1
0
        public List <New> NewPageList(int index, int typeId, string Name, out int count, int pageSize = 10, bool IsShow = false)
        {
            Expression <Func <New, bool> > where = (c => c.IsDelete == 0);

            if (typeId > 0)
            {
                if (string.IsNullOrWhiteSpace(Name))
                {
                    where = (c => c.IsDelete == 0 && c.TypeId == typeId);
                    if (IsShow)
                    {
                        where = (c => c.IsDelete == 0 && c.TypeId == typeId && c.display == 0);
                    }
                }
                else
                {
                    where = (c => c.IsDelete == 0 && c.TypeId == typeId && c.Name.Contains(Name));
                    if (IsShow)
                    {
                        where = (c => c.IsDelete == 0 && c.TypeId == typeId && c.display == 0);
                    }
                }
            }
            if (!string.IsNullOrWhiteSpace(Name))
            {
                where = (c => c.IsDelete == 0 && c.Name.Contains(Name));
                if (IsShow)
                {
                    where = (c => c.IsDelete == 0 && c.TypeId == typeId && c.display == 0);
                }
            }
            return(dal.QueryByPage(index, pageSize, out count, where, c => c.id));
        }