예제 #1
0
 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 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;
 }
예제 #4
0
        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();
        }
예제 #5
0
 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;
 }
예제 #6
0
        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();
        }