Beispiel #1
0
        /// <summary>
        /// 新增文章
        /// </summary>
        /// <param name="article">文章对象</param>
        /// <returns></returns>
        public static async Task <Article> AddArticle(Article article)
        {
            try
            {
                //插入文章
                await articleDal.AddArticle(article);

                if (article.Type == 5)
                {
                    await InsertOrUpdateES(article);
                }
            }
            catch (Exception ex)
            {
                article = null;
                logger.Error(ex);
            }
            return(article);
        }
Beispiel #2
0
        //[ValidateInput(false)]
        public ActionResult SubmitBlogEditor(SubmitBlogEditorRequest request)
        {
            Article article = new Article();


            if (request.Id != null)
            {
                article.Id = request.Id.Value;
            }

            article.ArticleLabel    = AnalyzeLabelString(request.LabelString);
            article.Title           = request.Title.Trim();
            article.Content         = request.Content;
            article.PublicationTime = DateTime.Now;
            if (request.Id == null)
            {
                ArticleDal.AddArticle(article);
            }
            else
            {
                ArticleDal.UpdateArticle(article);
            }
            return(Redirect("Index"));
        }
Beispiel #3
0
 public bool AddArticle(article ar) => article.AddArticle(ar);