Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 public Task <PostReference> SavePostAsync(PostContent post)
 {
     return(SavePostAsync(GetUniquePostId(), post));
 }
Ejemplo n.º 3
0
 public static string RenderPost(PostContent post)
 {
     return(s_markdownProcessor.Value.Transform(post.Content));
 }