Ejemplo n.º 1
0
        public UserListViewModel Get([FromUri]UserListInputModel inputModel)
        {
            if (inputModel == null) inputModel = new UserListInputModel();

            var filter = new UserFilter();
            _mapper.Map(inputModel, filter);

            var users = UserService.GetUsers(filter, inputModel.CurrentPage, inputModel.NumPerPage);
            return new UserListViewModel(users);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Retrieve a paged list of all users.
 /// </summary>
 /// <param name="filter">Filter to search users</param>
 /// <param name="currentPage">Current page number </param>
 /// <param name="numPerPage"># of records per page</param>
 /// <returns>Paged list of users</returns>
 public IPagedList<User> GetUsers(UserFilter filter, int currentPage, int numPerPage)
 {
     int totalRecords = 0;
     List<User> users = _userRepository.Search(filter, currentPage,
         numPerPage, out totalRecords).ToList();
     return new PagedList<User>(users, currentPage, numPerPage, totalRecords);
 }