public bool DeleteArticle(string login, string password, string blogname, long articleId) { BusinessManagement.User user = new User(login); if (!user.Exists || !user.IsPasswordValid(password)) return false; Blog blog = new Blog(login, blogname); BusinessManagement.Article art = new BusinessManagement.Article(); DataAccess.T_Article article = BusinessManagement.Article.Get(articleId); if (!blog.Exists || article == null || article.BlogId != blog.Id) return false; art.Delete(articleId); return true; }
public List<Article> GetArticlesFromBlog(string blogOwner, string blogName) { List<Article> articles = new List<Article>(); Blog blog = new Blog(blogOwner, blogName); BusinessManagement.Article art = new BusinessManagement.Article(); if (!blog.Exists) return articles; blog.GetArticles().ForEach(item => { Dbo.Article dboArt = BusinessManagement.Article.GetArticleDbo(item.Id); articles.Add(ConvertToWebArticle(dboArt)); }); return articles; }
public List <Article> GetArticlesFromBlog(string blogOwner, string blogName) { List <Article> articles = new List <Article>(); Blog blog = new Blog(blogOwner, blogName); BusinessManagement.Article art = new BusinessManagement.Article(); if (!blog.Exists) { return(articles); } blog.GetArticles().ForEach(item => { Dbo.Article dboArt = BusinessManagement.Article.GetArticleDbo(item.Id); articles.Add(ConvertToWebArticle(dboArt)); }); return(articles); }
public bool DeleteArticle(string login, string password, string blogname, long articleId) { BusinessManagement.User user = new User(login); if (!user.Exists || !user.IsPasswordValid(password)) { return(false); } Blog blog = new Blog(login, blogname); BusinessManagement.Article art = new BusinessManagement.Article(); DataAccess.T_Article article = BusinessManagement.Article.Get(articleId); if (!blog.Exists || article == null || article.BlogId != blog.Id) { return(false); } art.Delete(articleId); return(true); }