public async Task <ActionResult> AddComment(CreateCommentViewModel model) { var userid = Guid.Parse(Session["userid"].ToString()); IArticleManager manager = new ArticleManager(); await manager.CreateComment(userid, model.Id, model.content); return(Json(new { result = "ok" })); }
public async Task <ActionResult> AddComment(CreateCommentsViewModel model) { IArticleManager articleManager = new ArticleManager(); var userId = Guid.Parse(Session["userId"].ToString()); await articleManager.CreateComment(model.Id, userId, model.Comment); return(Json(new { result = "OK" })); }
public async Task <ActionResult> AddComment(Models.ArticleViewModels.CreateCommentViewModel model) { var userid = Guid.Parse(Session["userid"].ToString()); BlogSystem.IBLL.IArticleManager articleManager = new ArticleManager(); await articleManager.CreateComment(userid, model.Id, model.Content); return(Json(new { result = "ok" })); }
public async Task <ActionResult> AddComment(CreateCommentViewModel model) { string userid = ""; string message; if (Request.Cookies["userId"] != null) { if (!JwtHelper.GetJwtDecode(Request.Cookies["userId"].Value, out userid, out message)) { return(Json(new { result = message, status = "fail" })); } } string userId = Session["userId"] == null ? userid : Session["userId"].ToString(); if (userId == "") { return(Json(new { result = "尚未登陆无法操作!", status = "fail" })); } IArticleManager articleManager = new ArticleManager(); await articleManager.CreateComment(model.Id, Guid.Parse(userId), model.Content); return(Json(new { status = "ok" })); }