public async Task <PostReference> SavePostAsync(string id, PostContent post) { var client = await _storageClient.Value; var serialized = JsonConvert.SerializeObject(post); var buffer = Encoding.UTF8.GetBytes(serialized); _logger.LogDebug($"Laving post {id}"); var destination = new Object { Bucket = _storageBucket, Name = GetPostName(id), Metadata = new Dictionary <string, string> { { TitleMetadataKey, post.Title } }, }; using (var content = new MemoryStream(buffer)) { await client.Objects.Insert(destination, _storageBucket, content, "").UploadAsync(); } return(new PostReference(id, post.Title)); }
public Task <PostReference> SavePostAsync(PostContent post) { return(SavePostAsync(GetUniquePostId(), post)); }
public static string RenderPost(PostContent post) { return(s_markdownProcessor.Value.Transform(post.Content)); }