Exemple #1
0
 public bool Insert(Comment model)
 {
     if (model != null)
     {
         if (_DataBase.InsertModel<Comment>(model))
             return true;
         return false;
     }
     return false;
 }
 public ActionResult Insert(string content, string articleId)
 {
     Comment model = new Comment()
     {
         Id = Guid.NewGuid().ToString("N"),
         ArticleId = articleId,
         ParentId = "0",
         Content = content,
         CreateTime = DateTime.Now,
         ModifyTime = DateTime.Now
     };
     if (CUR_USER != null)
     {
         model.UserId = CUR_USER.Id;//评论者ID
         model.CreateUser = CUR_USER.UserName;
         model.ModifyUser = CUR_USER.UserName;
     }
     if (_ICommentService.Insert(model))
     {
         return new ActionReturn(true, "评论成功!", null);
     }
     return new ActionReturn(false, "评论失败!", null);
 }
 public int Update(Comment model)
 {
     throw new NotImplementedException();
 }
 public bool Insert(Comment model)
 {
     return _ICommentDao.Insert(model);
 }
 public ActionResult Reply(string content, string articleId, string parentId = "0")
 {
     if (CUR_USER != null)
     {
         Comment model = new Comment()
         {
             Id = Guid.NewGuid().ToString("N"),
             ArticleId = articleId,
             UserId = CUR_USER.Id,//回复者ID
             ParentId = parentId,
             Content = content,
             CreateUser = CUR_USER.UserName,
             CreateTime = DateTime.Now,
             ModifyUser = CUR_USER.UserName,
             ModifyTime = DateTime.Now
         };
         if (_ICommentService.Insert(model))
         {
             return new ActionReturn(true, "回复成功!", null);
         }
         return new ActionReturn(false, "回复失败!", null);
     }
     return new ActionReturn(false, "请先登录!", null);
 }