コード例 #1
0
        public void UpsertDeltaLogPostMapping(DeltaLogPostMapping mapping)
        {
            var deltaLogPostMappingsCollection = _liteDatabase.GetCollection <DeltaLogPostMapping>(DeltaLogPostMappingsCollectionName);

            deltaLogPostMappingsCollection.EnsureIndex(d => d.Id, true);
            deltaLogPostMappingsCollection.Upsert(mapping);
        }
コード例 #2
0
        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);
        }