private Cinnost Create(EventCinnostCreated evt) { var model = new Cinnost() { Generation = evt.Generation, EventGuid = evt.EventId, CinnostId = evt.CinnostId, Value1 = evt.CinnostValue1, Value2 = evt.CinnostValue2 }; return(model); }
public async Task Add(CommandCinnostCreate cmd) { var ev = new EventCinnostCreated() { EventId = Guid.NewGuid(), Generation = 0, CinnostId = Guid.NewGuid(), }; var item = Create(ev); db.Cinnosti.Add(item); await db.SaveChangesAsync(); await _handler.PublishEvent(ev, MessageType.UzivatelCreated, ev.EventId, null, ev.Generation, item.CinnostId); }