public void AddExperience(Experience experience) { MongoCollection<ShortExperience> links = db.GetCollection<ShortExperience>("Experiences"); List<AudioLink> savedSounds = new List<AudioLink>(); foreach (AudioLink sound in experience.Sounds ?? new List<AudioLink>()) { savedSounds.Add(AddAudioLink(sound.LinkUrl, experience.Creator, sound.Description)); } experience.Sounds = savedSounds; experience.Visuals = AddImageLink(experience.Visuals.LinkUrl, experience.Creator, experience.Visuals.Description); ShortExperience dehydratedExperience = new ShortExperience(experience); links.Insert(dehydratedExperience); }
public void AddExperience(List<AudioLink> audioLinks, ImageLink imageLink, User builtBy, string description, bool share) { MongoCollection<ShortExperience> links = db.GetCollection<ShortExperience>("Experiences"); ShortExperience dehydratedExperience = new ShortExperience(new Experience(audioLinks, imageLink, builtBy, description, share)); links.Insert(dehydratedExperience); }
private Experience rehydrateExperience(ShortExperience dehydrated) { User user = GetUserByID(dehydrated.Creator); List<AudioLink> sounds = new List<AudioLink>(); if (dehydrated.Sounds != null) { sounds = dehydrated.Sounds.Select(x => GetAudioLinkById(x)).ToList(); } ImageLink visuals = GetImageLinkById(dehydrated.Visuals); Experience rehydrated = new Experience(sounds, visuals, user, dehydrated.Description, dehydrated.Share); rehydrated.id = dehydrated.id; return rehydrated; }