public async Task <IActionResult> CompleteAsync(Guid id, [FromBody] CompleteTodoCommand command) { if (id != command.Id) { throw new Exception("Url id param and request doesn't match"); } await requestSender.Send(command); return(NoContent()); }
public async Task <IActionResult> Complete([FromBody] CompleteTodoCommand command) { if (!ModelState.IsValid) { return(ErrorModelResult()); } try { var result = await _commandDispatcher.DispatchAsync <CompleteTodoCommand, Result>(command); return(ToResult(result)); } catch (FailureResult reqEx) { return(ErrorResult(reqEx)); } }