コード例 #1
0
ファイル: Article.cs プロジェクト: obscuredesign/web
 /// <summary>
 /// 
 /// </summary>
 public static Article Create(this DbSet<Article> source,
     string title,
     string urlSlug,
     int authorId,
     string textAbstract,
     string textContent,
     string textConclusion,
     IEnumerable<string> postprocessorAQNs = null,
     DateTime? created = null,
     DateTime? updated = null,
     DateTime? published = null)
 {
     var article = new Article
     {
         Title = title,
         Slug = urlSlug,
         Abstract = textAbstract,
         Content = textContent,
         Conclusion = textConclusion,
         PostprocessorAQM = ProcessorHelper.CreatePostprocessor(postprocessorAQNs).AssemblyQualifiedName,
         Created = created,
         Updated = updated ?? DateTime.UtcNow,
         Published = published,
         AuthorId = authorId,
     };
     source.Add(article);
     return article;
 }
コード例 #2
0
ファイル: ArticleTag.cs プロジェクト: obscuredesign/web
 public static void ConnectTagsToArticle(this DbSet<ArticleTag> source, Article article, IQueryable<Tag> tags)
 {
     var articleTags = tags.Select(t => new ArticleTag
     {
         ArticleId = article.ArticleId,
         TagId = t.TagId,
     }).ToList();
     source.AddRange(articleTags);
 }