Пример #1
0
        public async Task <IHttpActionResult> SearchWall(string searchString, int page = 1)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var userAndOrg     = GetUserAndOrganization();
            var foundWallPosts = await _wallService.SearchWallAsync(searchString, userAndOrg, page, WebApiConstants.DefaultPageSize);

            var mappedPosts    = _mapper.Map <IList <WallPostViewModel> >(foundWallPosts);
            var pagedViewModel = new PagedWallViewModel <WallPostViewModel>
            {
                PagedList = await mappedPosts.ToPagedListAsync(1, WebApiConstants.DefaultPageSize),
                PageSize  = WebApiConstants.DefaultPageSize
            };

            return(Ok(pagedViewModel));
        }