Ejemplo n.º 1
0
        public Task <GetGroupPostListResponseDto> GetPostListByGroupIdSync(GetGroupPostListRequestDto dto)
        {
            return(Task.Run(() =>
            {
                GetGroupPostListResponseDto resp = new GetGroupPostListResponseDto();
                resp.total =
                    _groupPostRepository.TableNoTracking.Count(t => t.GroupId.Equals(dto.group_id) && !t.IsOffLine);
                if (resp.total > dto.start)
                {
                    var postInfoEntities = _groupPostRepository.TableNoTracking.Where(t => t.GroupId.Equals(dto.group_id) && !t.IsOffLine).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] GetGroupPostListRequestDto dto)
        {
            var resp = await _groupService.GetPostListByGroupIdSync(dto);

            return(Ok(resp));
        }