public async Task <IActionResult> GetPostById(long postId) { var query = new GetPostByIdQuery(postId); var result = await _mediator.Send(query); return(result != null?Success(result) : Error(new { info = "خطایی رخ داده است" })); }
public async Task <IActionResult> GetPost([FromRoute] int postId) { var query = new GetPostByIdQuery(postId); var result = await _mediator.Send(query); return(result != null?Ok(result) : NotFound()); }
public async Task <OperationResult <PostMagazine> > Handle(GetPostByIdQuery request, CancellationToken cancellationToken) { var findPost = await unitOfWork.PostMagazineRepository.GetPostById(request.Id, cancellationToken); if (findPost.Result != null) { return(OperationResult <PostMagazine> .BuildSuccessResult(findPost.Result)); } return(OperationResult <PostMagazine> .BuildFailure(findPost.ErrorMessage)); }
public async Task <IActionResult> GetAsync([FromRoute] Guid postId) { var query = new GetPostByIdQuery(postId); var response = await _mediator.Send(query); if (response == null) { return(NotFound()); } return(Ok(response)); }
public async Task <Response <GetPostByIdQueryResponse> > Handle(GetPostByIdQuery request, CancellationToken cancellationToken) { throw new System.NotImplementedException(); }