public PagedList <Dto.ArticleDto> GetAllArticle(int id = 0, int pagesize = 10) { using (DAL.ArticleService asv = new DAL.ArticleService()) { return(asv.GetAllWhere(m => true, false) .Include(m => m.User) .Select(m => new Dto.ArticleDto { Id = m.Id, Title = m.Title, Content = m.Content, UserEmail = m.User.Email, UserId = m.UserId, CreatTime = m.CreatTime }).ToPagedList(id, pagesize)); } }
public async Task <List <Dto.ArticleDto> > GetAllArticleAsync(int pageIndex = 0, int pagesize = 10) { using (DAL.ArticleService asv = new DAL.ArticleService()) { return(await asv.GetAllWhere(m => true, false, pageIndex, pagesize) .Include(m => m.User) .Select(m => new Dto.ArticleDto { Id = m.Id, Title = m.Title, Content = m.Content, UserEmail = m.User.Email, UserId = m.UserId, CreatTime = m.CreatTime }).ToListAsync()); } }