public void HandleCustomerCreated(ICustomerCommand command)
        {
            CustomerCreatedCommand c = command as CustomerCreatedCommand;

            UserIdentifier       u    = new UserIdentifier(c.Userid);
            FirstNameValueObject f    = new FirstNameValueObject(c.Firstname);
            CustomerEntity       cust = new CustomerEntity(u, f, c.Firstname, c.Age, c.City, 10);

            Users us = cust.GetCustomerModelfromEntity();

            //if (_repo.GetUserbyID(c.Userid) != null) {
            _repo.NewUser(us);
            //}

            CustomerCreatedEvent e = new CustomerCreatedEvent(c.Userid, c.Firstname, c.Lastname, c.City);

            ServiceBusQueueStore.SendEvent(e);

            //save the customer
            // raise the event
        }
Exemplo n.º 2
0
 public async Task <ActionResult <Users> > Post([FromBody] CustomerCreatedCommand value)
 {
     _handler.HandleCustomerCreated(value);
     return(Ok());
 }