public static domain.Event MapToEntity(this EventWriteModel readModel) { return(new domain.Event { Id = Guid.NewGuid(), Name = readModel.Name, Starts = readModel.Starts, Ends = readModel.Ends, Location = readModel.Location }); }
public Guid CreateNewEvent([FromBody] EventWriteModel requestedEvent) { _logger.LogInformation("Create new event request received"); var orEvent = requestedEvent.MapToEntity(); orEvent.Id = Guid.NewGuid(); _writeRepo.StoreEvent(orEvent); _endpoint.Publish <INewEventCreated>(e => { e.EventId = orEvent.Id; }); return(orEvent.Id); }