예제 #1
0
        public IActionResult Publish(CommentModel model)
        {
            model.AccountId = UserModel.Id;

            if (model.AccountId == model.QuoteAccountId)
            {
                return(Json(false.ToResult("不能引用自己")));
            }

            // 发表评论
            var entity = model.MapTo <CommentModel, Comment>();

            entity.CreateTime = DateTime.Now;
            _context.Comment.Add(entity);
            int affect = _context.SaveChanges();

            if (affect > 0)
            {
                return(Json(true.ToResult()));
            }
            return(Json(false.ToResult()));
        }
예제 #2
0
 public static Z_Consultant_Comment ToEntity(this CommentModel model, Z_Consultant_Comment destination)
 {
     return(model.MapTo(destination));
 }
예제 #3
0
 public static Z_Consultant_Comment ToEntity(this CommentModel model)
 {
     return(model.MapTo <CommentModel, Z_Consultant_Comment>());
 }
예제 #4
0
 public static Comment ToEntity(this CommentModel model, Comment destination)
 {
     return(model.MapTo(destination));
 }
예제 #5
0
 public static Comment ToEntity(this CommentModel model)
 {
     return(model.MapTo <CommentModel, Comment>());
 }