Esempio n. 1
0
        public List <Guestbooks> GetDataList(ForPaging Paging, string Search)
        {
            //宣告要接受全部搜尋資料的物件
            IQueryable <Guestbooks> SearchData;

            //判斷搜尋是否為空或Null,用於決定要呼叫取得搜尋資料
            if (String.IsNullOrEmpty(Search))
            {
                SearchData = GetAllDataList(Paging);
            }
            else
            {
                SearchData = GetAllDataList(Paging, Search);
            }
            //先排序再根據分頁來回傳所需部分的資料陣列
            return(SearchData.OrderByDescending(p => p.Id).Skip((Paging.NowPage - 1) * Paging.ItemNum).Take(Paging.ItemNum).ToList());
        }