public ApiResult Praise(int id) { UserModel userModel = Auth.GetLoginUser(_httpContext); _articleService.Praise(id, userModel.Account, false); string message = _notifyValidationHandler.GetErrorList().Select(s => s.Value).FirstOrDefault(); if (!string.IsNullOrEmpty(message)) { return(ApiResult.Error(HttpStatusCode.BAD_REQUEST, message)); } return(ApiResult.Success()); }
public ApiResult Review() { string content = Request.Form["content"]; int articleId = Convert.ToInt32(Request.Form["articleId"]); string revicer = Request.Form["revicer"]; string replyId = Request.Form["replyId"]; int commentType = Convert.ToInt32(Request.Form["commentType"]); try { CommentModel commentModel = new CommentModel(); commentModel.Content = content; commentModel.AdditionalData = replyId; commentModel.PostUser = Auth.GetLoginUser(_httpContext).Account; commentModel.Revicer = revicer; commentModel.CommentType = commentType; _articleService.Review(commentModel, articleId); return(ApiResult.Success()); } catch (AuthException) { return(ApiResult.Error(HttpStatusCode.FORBIDDEN, "not login")); } }