public async Task <ActionResult> Post(int post, [FromBody] CommentCreateCommand command) { if (post != command.Id_Post) { return(NotFound()); } var result = await m_commandResolver.Publish <CommentCreateCommand, CommentCreateResult>(command); if (result.Exception != null) { return(StatusCode((int)HttpStatusCode.InternalServerError)); } if (result.ValidationErrors.Any()) { return(BadRequest(result.ValidationErrors)); } return(CreatedAtAction(nameof(Get), new { post, id = result.Created }, result)); }
public async Task <ActionResult> Post([FromBody] PostCreateCommand command) { var result = await m_commandResolver.Publish <PostCreateCommand, PostCreateResult>(command); return(CreateOrEditResult(result.Created, result)); }
public CommentCreateResult CreateComment(Post post, CommentCreateCommand command) { return(m_resolver.Publish <CommentCreateCommand, CommentCreateResult>(command).Result); }