public async Task <IActionResult> Post([FromBody] CreateTaskCmd cmd, [FromServices] ICommandHandlerAsync <CreateTaskCmd> handler) { if (!ModelState.IsValid) { var errors = GetErrors(); throw new CustomException((int)ExceptionCode.Validation, errors); } cmd.Validate(); await this._dispatcher.PushAsync(handler, cmd); _logger.LogInformation("Create task"); return(Json(new Json(cmd.Result))); }