public IQueryable<FileContent> GetAllFileList(ForPaging paging) { IQueryable<FileContent> SearchedFiles = fileDB.FileContent; paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(SearchedFiles.Count()/paging.ItemNum))); paging.CheckPage(); return SearchedFiles; }
private IQueryable<Message> GetMessagesFromDB(ForPaging paging, int articleId) { IQueryable<Message> dataFromDB = db.Message.Where(p => p.ArticleId == articleId); paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(dataFromDB.Count())/paging.ItemNum)); paging.CheckPage(); return dataFromDB; }
public IQueryable<Guestbooks> GetAllDataFromDB(ForPaging paging) { IQueryable<Guestbooks> fetchedData = db.Guestbooks; paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(fetchedData.Count()) / paging.ItemNum)); paging.CheckPage(); return fetchedData; }
public List<int> GetIdList(ForPaging paging) { paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(db.Item.Count() / paging.ItemNum))); paging.CheckPage(); return db.Item.OrderByDescending(p=>p.Id). Skip((paging.CurrentPage-1) * paging.ItemNum).Take(paging.ItemNum).Select(p => p.Id).ToList(); }
public IQueryable<Guestbooks> GetAllDataFromDB(ForPaging paging, string search) { IQueryable<Guestbooks> fetchedData = db.Guestbooks.Where(s => s.Account.Contains(search) || s.Content.Contains(search) || s.Reply.Contains(search)); paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(fetchedData.Count()) / paging.ItemNum)); paging.CheckPage(); return fetchedData; }
public List<Guestbooks> GetGuestbooksList(ForPaging paging, string search) { IQueryable<Guestbooks> SearchData = null; if (string.IsNullOrEmpty(search)) { SearchData = GetAllDataFromDB(paging); } else { SearchData = GetAllDataFromDB(paging, search); } return SearchData.OrderByDescending(p=>p.Id).Skip((paging.CurrentPage-1)*paging.ItemNum).Take(paging.ItemNum).ToList(); }
public List<Article> GetArticleList(ForPaging paging, string search) { IQueryable<Article> queriedResult; if (string.IsNullOrEmpty(search)) { queriedResult = db.Article; } else { queriedResult = db.Article.Where(p => p.Content.Contains(search) || p.Account.Contains(search) || p.Title.Contains(search)); } paging.MaxPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(queriedResult.Count()) / paging.ItemNum)); paging.CheckPage(); return queriedResult.OrderByDescending(p=>p.ArticleId) .Skip((paging.CurrentPage-1)*paging.ItemNum).Take(paging.ItemNum).ToList(); }
public List<FileContent> GetFileList(ForPaging paging) { IQueryable<FileContent> SearchedFiles = GetAllFileList(paging); return SearchedFiles.OrderByDescending(p => p.Id) .Skip((paging.CurrentPage - 1) * paging.ItemNum).Take(paging.ItemNum).ToList(); }
public List<Message> MessageList(ForPaging paging, int articleId) { IQueryable<Message> messageList = GetMessagesFromDB(paging, articleId); return messageList.OrderByDescending(p=>p.MessageId).Skip((paging.CurrentPage-1)*paging.ItemNum) .Take(paging.ItemNum).ToList(); }