private void HandleCreateMethod(CreateMethod createMethod) { Result <Method> methodCreationResult = _repository.CreateMethod(createMethod); if (methodCreationResult.IsFailure) { MethodCreationFailed failedMethod = new MethodCreationFailed( methodCreationResult.Error, createMethod.LoggedInUserId, createMethod.SagaId ); _kafkaProducer.Produce(failedMethod, METHODS_TOPIC); return; } MethodCreated createdMethod = new MethodCreated( methodCreationResult.Value.Id, methodCreationResult.Value.Creator, methodCreationResult.Value.Name, methodCreationResult.Value.ApplicationRate, methodCreationResult.Value.CreationDate, createMethod.LoggedInUserId, createMethod.SagaId ); _kafkaProducer.Produce(createdMethod, METHODS_TOPIC); }
private async void HandleMethodCreationFailed(MethodCreationFailed m) { var failedMethod = new { failureReason = m.FailureReason }; await _hubContext.Clients.Groups(m.LoggedInUserId.ToString()).SendAsync("ReceiveMethodCreatedMessage", failedMethod); }