Ejemplo n.º 1
0
        public bool AddArticle(string login, string password, string blogname, Article article)
        {
            BusinessManagement.User user = new User(login);
            if (!user.Exists || !user.IsPasswordValid(password))
            {
                return(false);
            }

            BusinessManagement.Blog blog = new Blog(login, blogname);

            if (!blog.Exists)
            {
                return(false);
            }

            BusinessManagement.Article.Create(blog.Id, article.MediaUrl, (long)ConvertToMediaType(article.MediaType), article.Text, TagsAsString(article.Tags));

            return(true);
        }
Ejemplo n.º 2
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);
        }