public virtual async Task <ListResult <T> > GetListAsync(QueryParram parram) { IQueryable <T> query = _db.Set <T>().AsNoTracking(); List <T> datas = await query.Skip(parram.Page - 1 *parram.Limit).Take(parram.Limit).ToListAsync <T>(); int total = await query.CountAsync(); return(new ListResult <T>(datas, total)); }
public async Task <IActionResult> GetList([FromBody] UserModel user) { QueryParram queryParram = new QueryParram(1, 2); ResponseService <ListResult <User> > response = await _userService.GetListAsync(queryParram); if (response.Success) { return(Ok(response.Resource)); } else { return(BadRequest(response.Message)); } }
public async Task <ResponseService <ListResult <User> > > GetListAsync(QueryParram parram) { ListResult <User> users = await _userRepositoty.GetListAsync(parram); return(new ResponseService <ListResult <User> >(users)); }