public void Post([FromBody] Broker broker) { try { _repository.Save(broker); } catch (Exception e) { Console.WriteLine(e); } }
public async Task <Result> Handle( CreateUserCommand request, CancellationToken cancellationToken) { var result = await identity.Register(request); if (!result.Succeeded) { return(result); } var user = result.Data; var broker = brokerFactory .WithName(request.Name) .WithPhoneNumber(request.PhoneNumber) .Build(); user.BecomeBroker(broker); await brokerRepository.Save(broker, cancellationToken); return(result); }