public static ResourceLogHistoryDocument ToDocument(this ResourceLogHistory history) => new ResourceLogHistoryDocument() { CollectionId = history.CollectionId, ResourceId = history.ResourceId, Id = history.Id, Logs = history.Logs.Select(p => p.ToDocument()) .ToList(), Version = history.Version };
public async Task Handle(LoggedEntityCreatedDomainEvent @event) { var history = await _repository.GetbyResourceId(@event.ResourceId); if (history == null) { var logs = ResourceLogHistory.Create(); logs.ApplyEvent(@event); await _repository.AddAsync(logs); } }
public async Task UpdateAsync(ResourceLogHistory history) => await _repository.Update(history.ToDocument());
public async Task Remove(ResourceLogHistory resourceLogHistory) => await _repository.Delete(resourceLogHistory.ToDocument());
public async Task AddAsync(ResourceLogHistory history) => await _repository.AddAsync(history.ToDocument());