public async Task <ActionResult> Update(int id, [FromBody] PostUpdateRequest payload) { var updateResult = await postUpdater.Handle(new PostUpdateParams(User !, id, payload.Body)); return(updateResult.Match <ActionResult>( updatedPost => Ok(updatedPost), fail => BadRequest(fail) )); }
public async Task <IActionResult> Update(int id, [FromBody] PostUpdateRequest payload) => (await mediator.Command(new PostUpdateCommand(id, new PostUpdate(payload.Body), User !)))