public Task <GetPostDetailResponseDto> GetPostDetailByIdSync(GetPostDetailRequestDto dto) { return(Task.Run(() => { var postInfoEntity = _groupPostRepository.TableNoTracking.SingleOrDefault(t => t.Id.Equals(dto.post_id)); if (postInfoEntity != null) { GetPostDetailResponseDto resp = Mapper.Map <GetPostDetailResponseDto>(postInfoEntity); var postContentEntity = _groupPostContentRepository.TableNoTracking.SingleOrDefault(t => t.PostId.Equals(dto.post_id)); resp.content = postContentEntity.Content; return resp; } throw new NotFoundException("不存在该帖子"); })); }
public async Task <IHttpActionResult> Get([FromUri] GetPostDetailRequestDto dto) { var resp = await _groupService.GetPostDetailByIdSync(dto); return(Ok(resp)); }