示例#1
0
        public void HandleCommand(ICommand command)
        {
            string abc = command.GetType().Name;

            switch (abc)
            {
            case "NewCustomerCommand": {
                var cust  = command as NewCustomerCommand;
                var cust1 = repo.GetCustomerbyID(cust.CustomerId);
                if (cust1 is null)
                {
                    CustomerEntity entity = new CustomerEntity();

                    var aa      = entity.CreateCustomer(cust);
                    var newCust = new Customer();

                    newCust.CustomerId = cust.CustomerId;
                    newCust.FirstName  = cust.FirstName;
                    newCust.LastName   = cust.LastName;
                    //repo.InsertCustomer(newCust);
                    ServiceBus.sendMessage(aa).GetAwaiter().GetResult();
                }
                break;
            }
            }
        }