Beispiel #1
0
        //[Authorize(Roles = "Admin")]
        public ActionResult <string> AddArticle(Article article)
        {
            //string articleName, string content, string createUser, int classificationId,status
            string articleName      = article.ArticleName;
            string CreateUser       = article.InUser;
            int    classificationId = article.ClassificationId;
            int    userId           = article.UserId;

            article.InDate = DateTime.Now;

            log.Info("添加的文章名为:" + articleName + ",添加的用户是:" + CreateUser + ",添加的分类Id为:" + classificationId);
            if (userId != 0 && articleName != null && CreateUser != null && classificationId != 0)
            {
                string result = _managementService.AddArticle(article);
                return(Ok(result));
            }
            return(NotFound("添加的文章名、用户名或分类Id为空"));
        }