private SyndicationItem ConvertItem( BlogPostDocument document ) { var result = new SyndicationItem(document.Title, MarkdownHelper.RenderMarkdown(document.Content), Url.AbsoluteAction("Details", "BlogPost", new {id = document.GetUrlId()}), document.GetUrlId().ToString(CultureInfo.InvariantCulture), document.UpdatedOn); result.AddPermalink(Url.AbsoluteAction("Details","BlogPost",new {id = document.Title})); foreach (var link in (document.Links ?? new Link[0]).Where(l => !string.IsNullOrWhiteSpace(l.Url))) { result.Links.Add(new SyndicationLink(new Uri(link.Url),"external",link.Title,"text/html",0)); } return result; }
private bool StoreImage(HttpPostedFileWrapper imageFile,BlogPostDocument document) { if (imageFile != null && imageFile.ContentLength > 0 ) { document.HasImage = true; var existingImage = DocumentSession.Advanced.DatabaseCommands.GetAttachment(document.Id); Guid? etag = null; if (existingImage != null) { etag = existingImage.Etag; } using(imageFile.InputStream) { DocumentSession.Advanced.DatabaseCommands.PutAttachment(document.Id, etag, imageFile.InputStream,new RavenJObject() ); return true; } } return false; }