public async Task UpdateSample(SampleDto dto) { var sample = await repo.GetSample(dto.Id); await repo.UpdateSample(dto.ToSample()); var createdEvent = new SampleUpdatedEvent(dto.Id, sample.ToSampleDto(), dto); eventContext.AddEvents(createdEvent); }
public async Task <Guid> InsertSample(SampleDto dto) { var sample = dto.ToSample(); await repo.InsertSample(sample); var createdEvent = new SampleCreatedEvent(sample.ToSampleDto()); eventContext.AddEvents(createdEvent); return(sample.Id); }