public async Task <IEnumerable <User> > Handle(GetAllUsersQuery query, CancellationToken cancellationToken) { var UserList = await _context.Users .ToListAsync(); if (UserList == null) { return(null); } return(UserList.AsReadOnly()); }
public async Task <PagedResponse <IEnumerable <GetAllUsersViewModel> > > Handle(GetAllUsersQuery request, CancellationToken cancellationToken) { var validFilter = _mapper.Map <GetAllUsersParameter>(request); var user = await _repo.GetPagedReponseAsync(validFilter.PageNumber, validFilter.PageSize); var userViewModel = _mapper.Map <IEnumerable <GetAllUsersViewModel> >(user); return(new PagedResponse <IEnumerable <GetAllUsersViewModel> >(userViewModel, validFilter.PageNumber, validFilter.PageSize)); }