Exemple #1
0
        [ValidateInput(false)]                                                                                                                                      //富文本防恶意字符串输入
        public async Task <ActionResult> IsCreateArticle(string title, string content, Guid userid, Guid[] categoryIds, bool IsClosingComments, bool state = false) //保存草稿
        {
            IArticleManger articleManger = new ArticleManger();

            if (categoryIds == null)
            {
                await articleManger.CreateArticle(title, content, userid, IsClosingComments, state);

                return(Json(new { status = 1, data = "成功保存到草稿箱" }));
            }
            else
            {
                await articleManger.CreateArticle(title, content, categoryIds, userid, IsClosingComments, state);

                return(Json(new { status = 1, data = "成功保存到草稿箱" }));
            }
        }
Exemple #2
0
        public async Task <ActionResult> CreateArticle(string title, string content, Guid userid, Guid[] categoryIds, bool IsClosingComments, bool state = true) //已发布
        {
            IArticleManger articleManger = new ArticleManger();

            if (categoryIds == null)                                                                 //用户可以选择对文章不进行分类
            {
                await articleManger.CreateArticle(title, content, userid, IsClosingComments, state); //调用为添加分类的博客新增

                //return RedirectToAction("UserHome", "User", new { userid = userid });
                return(Json(new { status = 1, data = "发布成功" }));
            }
            else
            {
                await articleManger.CreateArticle(title, content, categoryIds, userid, IsClosingComments, state);

                //return RedirectToAction("UserHome", "User", new { userid = userid });
                return(Json(new { status = 1, data = "发布成功" }));
            }
        }