Ejemplo n.º 1
0
 public void OnKlantCreated(KlantCreatedEvent incomingEvent)
 {
     try
     {
         _autoRepo.Insert(new Entities.Klant()
         {
             Id             = incomingEvent.KlantId,
             Voorletters    = incomingEvent.Voorletters,
             Tussenvoegsel  = incomingEvent.Tussenvoegsel,
             Achternaam     = incomingEvent.Achternaam,
             Telefoonnummer = incomingEvent.Telefoonnummer,
         });
     }
     catch (Exception e)
     {
         ExceptionEventPublisher.PublishException(e);
     }
 }
Ejemplo n.º 2
0
        public Klant CreateKlant(Klant klant)
        {
            _repository.Insert(klant);

            // throw KlantCreatedEvent
            var klantCreatedEvent = new KlantCreatedEvent()
            {
                GUID           = Guid.NewGuid().ToString(),
                RoutingKey     = "Jomaya.Klant.KlantCreated",
                TimeStamp      = DateTime.UtcNow,
                KlantId        = klant.Id,
                Voorletters    = klant.Voorletters,
                Tussenvoegsel  = klant.Tussenvoegsel,
                Achternaam     = klant.Achternaam,
                Telefoonnummer = klant.Telefoonnummer,
            };

            _publisher.Publish(klantCreatedEvent);

            return(klant);
        }