Esempio n. 1
0
        public Task <GetPostListByQueryResponseDto> GetPostListByTitleSycn(GetPostListByQueryRequestDto dto)
        {
            return(Task.Run(() =>
            {
                GetPostListByQueryResponseDto resp = new GetPostListByQueryResponseDto();
                resp.total =
                    _groupPostRepository.TableNoTracking.Count(t => t.Title.Contains(dto.q) && !t.IsOffLine);
                if (resp.total > dto.start)
                {
                    var postInfoEntities = _groupPostRepository.TableNoTracking.Where(t => t.Title.Contains(dto.q)).OrderByDescending(t => t.GMTCreate).Skip(dto.start).Take(dto.length);
                    if (postInfoEntities.Any())
                    {
                        resp.data = Mapper.Map <List <PostInfo> >(postInfoEntities);
                    }
                }

                return resp;
            }));
        }
        public async Task <IHttpActionResult> Get([FromUri] GetPostListByQueryRequestDto dto)
        {
            var resp = await _groupService.GetPostListByTitleSycn(dto);

            return(Ok(resp));
        }