示例#1
0
        public Task <AddCustomerToGroupResponse> addCustomerToGroup(AddCustomerToGroupRequest request)
        {
            ChangeCustomerGroupCommand command = new ChangeCustomerGroupCommand(request.customer_id, request.customer_group_id);
            Task <object> CustomerGroup        = (Task <object>)Bus.SendCommand(command);
            //RabbitMQBus.Publish(command);
            AddCustomerToGroupResponse response = new AddCustomerToGroupResponse();

            response = Common <AddCustomerToGroupResponse> .checkHasNotification(_notifications, response);

            if (response.Success)
            {
                CustomerGroupModel CustomerGroupModel = (CustomerGroupModel)CustomerGroup.Result;
                response.Data = (bool)CustomerGroup.Result;
            }
            return(Task.FromResult(response));
        }
示例#2
0
 public Task <object> Handle(ChangeCustomerGroupCommand command, CancellationToken cancellationToken)
 {
     if (!command.IsValid())
     {
         NotifyValidationErrors(command);
     }
     else
     {
         bool resullt = _CustomerRepository.ChangeCustomerGroup(command.CustomerGroupId, command.Id);
         if (!resullt)
         {
             _bus.RaiseEvent(new DomainNotification("Customer", "Server error", NotificationCode.Error));
         }
         return(Task.FromResult(resullt as object));
     }
     return(Task.FromResult(false as object));
 }