public override Article CreateArticle(Category category, string owner, string name, string title, string description, string body) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ArticleDataStore articleStore = new ArticleDataStore(transaction); if (articleStore.FindByName(name) != null) throw new ArticleNameAlreadyExistsException(name); CategoryDataStore dataStore = new CategoryDataStore(transaction); dataStore.Attach(category); Article article = new Article(category, name, owner, title, description, body); article.Author = owner; if (category.AutoApprove) article.Approved = true; articleStore.Insert(article); transaction.Commit(); return article; } }
public Article(Category pCategory, string pName, string pOwner, string pTitle, string pDescription, string pBody) : base(pOwner, pTitle) { Category = pCategory; Name = pName; Description = pDescription; Body = pBody; }
public override Category CreateCategory(string name, string displayName) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { CategoryDataStore dataStore = new CategoryDataStore(transaction); Category category = new Category(name, displayName); dataStore.Insert(category); transaction.Commit(); return category; } }
public override void UpdateCategory(Category category) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { CategoryDataStore dataStore = new CategoryDataStore(transaction); dataStore.Update(category); transaction.Commit(); } }
public override IList<Article> GetArticlesByOwner(Category category, string owner, ArticleStatus status) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ArticleDataStore dataStore = new ArticleDataStore(transaction); return dataStore.FindByCategoryAndOwner(category, owner, status); } }
public abstract void UpdateCategory(Category category);
public abstract IList<Article> GetArticles(Category category, ArticleStatus status);
public abstract IList<Article> GetArticlesByOwner(Category category, string owner, ArticleStatus status);
public abstract Article CreateArticle(Category category, string owner, string name, string title, string description, string body);
public abstract void DeleteCategory(Category category);
public static void DeleteCategory(Category category) { Provider.DeleteCategory(category); }
public static Article CreateArticle(Category category, string owner, string name, string title, string description, string body) { return Provider.CreateArticle(category, owner, name, title, description, body); }
public static void UpdateCategory(Category category) { Provider.UpdateCategory(category); }
public static IList<Article> GetArticlesByOwner(Category category, string owner, ArticleStatus status) { return Provider.GetArticlesByOwner(category, owner, status); }
public static IList<Article> GetArticles(Category category, ArticleStatus status) { return Provider.GetArticles(category, status); }