コード例 #1
0
            public async Task <IEnumerable <User> > Handle(GetAllUsersQuery query, CancellationToken cancellationToken)
            {
                var UserList = await _context.Users
                               .ToListAsync();

                if (UserList == null)
                {
                    return(null);
                }
                return(UserList.AsReadOnly());
            }
コード例 #2
0
ファイル: GetAllUsersQuery.cs プロジェクト: jtempra/AquaMobCA
        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));
        }