Exemplo n.º 1
0
        private Mail Create(EventMailSenderCreated evt)
        {
            var model = new Mail()
            {
                Generation = evt.Generation,
                EventGuid  = evt.EventId,
                MailId     = evt.MailSenderId,
                Value1     = evt.MailSenderValue1,
                Value2     = evt.MailSenderValue2
            };

            return(model);
        }
Exemplo n.º 2
0
        public async Task Add(CommandMailSenderCreate cmd)
        {
            var ev = new EventMailSenderCreated()
            {
                EventId      = Guid.NewGuid(),
                Generation   = 0,
                MailSenderId = Guid.NewGuid(),
            };
            var item = Create(ev);

            db.Mails.Add(item);
            await db.SaveChangesAsync();

            await _handler.PublishEvent(ev, MessageType.UzivatelCreated, ev.EventId, null, ev.Generation, item.MailId);
        }