/// <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; }
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); }