public async Task <Pagination <UserForListDto> > GetUserForList(UserQueryParams userQueryParams) { var spec = new UserWithTitleAndCampusSpesification(userQueryParams); var users = await userDal.ListEntityWithSpecAsync(spec); var countSpec = new UserWithFilterForCaountSpecification(userQueryParams); var totalItems = await userDal.CountAsync(countSpec); if (users == null) { throw new RestException(HttpStatusCode.BadRequest, new { UsersNotFound = Messages.UserNotFound }); } var data = mapper.Map <List <User>, List <UserForListDto> >(users); return(new Pagination <UserForListDto> ( userQueryParams.PageIndex, userQueryParams.PageSize, totalItems, data )); }