/// <inheritdoc />
    public override async Task HandleAsync(ActiveCustomerIntegrationEvent @event)
    {
        var command = new ActiveCustomerCommand
        {
            CustomerId = @event.CustomerId
        };

        await _bus.SendAsync(command);
    }
Exemplo n.º 2
0
        public async Task <IActionResult> ActiveCustomerAsync(Guid customerId)
        {
            var command = new ActiveCustomerCommand {
                CustomerId = customerId
            };

            await SendCommandAsync(command);

            return(Ok());
        }
        public async Task <ActiveCustomerCommandResponse> Handle(ActiveCustomerCommand command)
        {
            var customer = await _repository.FindAsync(command.Id);

            if (customer == null)
            {
                throw new DomainException("مشتری یافت نشد");
            }
            customer.Active();
            _context.SaveChanges();
            await _eventBus.Publish <IActiveUserEvent>(new ActiveUserEvent(customer.UserId, AppType.Customer));

            return(new ActiveCustomerCommandResponse());
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> Put(ActiveCustomerCommand command)
        {
            var response = await Bus.Send <ActiveCustomerCommand, ActiveCustomerCommandResponse>(command);

            return(Ok(response));
        }