SetBody() public method

public SetBody ( string body ) : void
body string
return void
示例#1
0
        private void Store(MarkdownFile file)
        {
            try
            {
                var s = _session.Value;
                using (var tx = s.BeginTransaction())
                {
                    var chosenTags = ChosenTags(file, s);
                    var c = new Content
                    {
                        IsMarkdown = true,
                        Published = true,
                        Created = file.Publish.HasValue ? file.Publish.Value : DateTime.UtcNow,
                        Title = file.Title
                    };

                    c.SetBody(file.PostBody);

                    chosenTags.ForEach(c.AssociateWithTag);

                    s.Save(c);
                    tx.Commit();
                    file.HasBeenStoredLocally = true;
                }
            }
            catch (Exception)
            {
                // What could we sensibly do?
            }
        }
示例#2
0
        public Content CreateContent(int id, string title, DateTime created)
        {
            var content = new Content(id)
                            {
                                Title = title,
                                Published = true,
                                Created = created
                            };

            content.SetBody("Body");
            return content;
        }