public void UpsertDeltaLogPostMapping(DeltaLogPostMapping mapping) { var deltaLogPostMappingsCollection = _liteDatabase.GetCollection <DeltaLogPostMapping>(DeltaLogPostMappingsCollectionName); deltaLogPostMappingsCollection.EnsureIndex(d => d.Id, true); deltaLogPostMappingsCollection.Upsert(mapping); }
private string createNewPost(string title, string text, string mainSubPostId, string mainSubPostPermalink) { // Make new post to the DeltaLog sub var newPost = _subredditService.Post(title, text, _appConfiguration.DeltaLogSubredditName); // Add new mapping var newPostMapping = new DeltaLogPostMapping { Id = mainSubPostId, MainSubPostUrl = mainSubPostPermalink, DeltaLogPostId = newPost.Id, DeltaLogPostUrl = newPost.Permalink }; _repository.UpsertDeltaLogPostMapping(newPostMapping); return(newPost.Permalink); }