public async Task <IActionResult> GetPost([FromRoute] int id)
        {
            var command = new GetPostCommand()
            {
                Id = id
            };

            return(Ok(await mediator.Send(command)));
        }
示例#2
0
        public virtual async Task <IActionResult> Get(int id)
        {
            return(await Runsafely(async() =>
            {
                var getPostCommand = new GetPostCommand(id);
                var post = await _mediator.Send(getPostCommand);
                if (post != null)
                {
                    return Ok(post);
                }

                return NotFound();
            }));
        }