Example #1
0
        public ResponseBody <PageEntity <List <sline_notes> > > PostPage([FromBody] NotesQueryParams pageParam)
        {
            var list = _INotesBLL.GetPage(pageParam);

            return(new ResponseBody <PageEntity <List <sline_notes> > > {
                Result = new PageEntity <List <sline_notes> > {
                    data = list, total = pageParam.total
                }, Code = "", Message = ""
            });
        }
Example #2
0
        public IQueryable <sline_notes> GetPage(NotesQueryParams pageParam)
        {
            try
            {
                var db    = new LTHWMysqlModel();
                var notes = from a in db.sline_notes
                            select a;

                if (!string.IsNullOrEmpty(pageParam.title))
                {
                    notes = notes.Where(p => p.title.Contains(pageParam.title));
                }

                if (pageParam.memberid > 0)
                {
                    notes = notes.Where(p => p.memberid == pageParam.memberid);
                }

                pageParam.total = notes.Count();

                if (pageParam.isDesc)
                {
                    notes = notes.OrderByDescending(c => c.modtime).Skip(pageParam.size * (pageParam.page - 1)).Take(pageParam.size);
                }
                else
                {
                    notes = notes.OrderBy(c => c.modtime).Skip(pageParam.size * (pageParam.page - 1)).Take(pageParam.size);
                }

                return(notes);
            }
            catch (Exception ex)
            {
                LogHelper.Error(this, ("文章:" + ex.Message + ex.InnerException.Message));
                return(null);
            }
        }
Example #3
0
 public List <sline_notes> GetPage(NotesQueryParams pageParam)
 {
     return(_INotesDAL.GetPage(pageParam).ToList <sline_notes>());
 }