Пример #1
0
        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;
        }
Пример #2
0
        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;
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }