public async Task <DeActiveCustomerCommandResponse> Handle(DeActiveCustomerCommand command) { var customer = await _repository.FindAsync(command.Id); if (customer == null) { throw new DomainException("مشتری یافت نشد"); } customer.DeActive(); _context.SaveChanges(); await _eventBus.Publish <IDeActiveUserEvent>(new DeActiveUserEvent(customer.UserId, AppType.Customer)); return(new DeActiveCustomerCommandResponse()); }
public async Task <IHttpActionResult> Put(DeActiveCustomerCommand command) { var response = await Bus.Send <DeActiveCustomerCommand, DeActiveCustomerCommandResponse>(command); return(Ok(response)); }