public async Task <ActionResult <WorkflowSetting> > Handle([FromBody] SaveWorkflowSettingRequest request, [FromRoute] ApiVersion apiVersion, CancellationToken cancellationToken) { var workflowSettingsId = request.Id; var workflowBlueprintId = request.WorkflowBlueprintId; var key = request.Key; var workflowSettings = !string.IsNullOrWhiteSpace(workflowSettingsId) ? await _workflowSettingsStore.FindByWorkflowBlueprintIdAndKeyAsync(workflowBlueprintId, key, cancellationToken) : default; if (workflowSettings == null) { workflowSettings = new WorkflowSetting { Id = !string.IsNullOrWhiteSpace(workflowSettingsId) ? workflowSettingsId : _idGenerator.Generate(), }; } workflowSettings.WorkflowBlueprintId = request.WorkflowBlueprintId.Trim(); workflowSettings.Key = request.Key.Trim(); workflowSettings.Value = request.Value?.Trim(); await _workflowSettingsStore.SaveAsync(workflowSettings, cancellationToken); return(CreatedAtAction("Handle", "Get", new { id = workflowSettings.Id, apiVersion = apiVersion.ToString() }, workflowSettings)); }
public async Task SaveAsync(WorkflowSetting entity, CancellationToken cancellationToken = default) { await _mediator.Publish(new WorkflowSettingsSaving(entity), cancellationToken); await _store.SaveAsync(entity, cancellationToken); await _mediator.Publish(new WorkflowSettingsSaved(entity), cancellationToken); }
public async Task SaveAsync(WorkflowSetting entity, CancellationToken cancellationToken) { entity = Initialize(entity); await _store.SaveAsync(entity, cancellationToken); }