public static TripDocument AsDocument(this Core.Entities.Trip trip) => new TripDocument { Id = trip.Id, Version = trip.Version, Destination = trip.Destination, TimeStamp = trip.Date.AsDaysSinceEpoch(), DifficultyLevel = trip.DifficultyLevel };
public static TripDocument AsDocument(this Core.Entities.Trip trip) => new TripDocument { Id = trip.Id, Version = trip.Version, Destination = trip.Destination, TimeStamp = trip.Date.AsDaysSinceEpoch(), DifficultyLevel = trip.DifficultyLevel, Participants = trip.Participants?.Select(p => new ParticipantDocument { UserId = p.UserId }) };
public Task UpdateAsync(Core.Entities.Trip trip) => _repository.Collection.ReplaceOneAsync(r => r.Id == trip.Id && r.Version < trip.Version, trip.AsDocument());
public Task AddAsync(Core.Entities.Trip trip) => _repository.AddAsync(trip.AsDocument());