public async Task <IResult> ExecuteAsync(CancellationToken cancellationToken)
        {
            var dtos = await _query.ExecuteAsync(cancellationToken);

            if (!dtos.Success)
            {
                return(dtos.WithoutData());
            }
            using var transaction = _unitOfWork.BeginTransaction();
            return(await _command.ExecuteAsync(dtos.Data).TapAsync(_ => transaction.CommitAsync()).WithoutDataAsync());
        }
Exemplo n.º 2
0
        public async Task <HttpResponseMessage> Create(CustomerModel model)
        {
            await _command.ExecuteAsync(model);

            CreateCustomerMessagingClient client = new CreateCustomerMessagingClient();

            client.CreateConnection();
            client.AddCustomerDataToQueue(model);
            client.Close();

            return(new HttpResponseMessage(HttpStatusCode.Created));
        }