Exemplo n.º 1
0
 public List <Comment_Object> GetByPostId(Guid?postId)
 {
     using (var db = new CarOnlineEntities())
     {
         var data = db.WEB_CARONLINE_SP_Comment_GetByPostId(postId);
         var list = new List <Comment_Object>();
         foreach (var item in data)
         {
             Comment_Object obj = new Comment_Object();
             obj.CommentId         = item.CommentId;
             obj.ContentComment    = item.ContentComment;
             obj.CreateDate        = item.CreateDate;
             obj.PostId            = item.PostId;
             obj.TotalOfLike       = item.TotalOfLike;
             obj.UserCreateCommnet = new AccountObject
             {
                 Avatar   = item.Avatar,
                 FullName = item.FullName,
                 Mobile   = item.Mobile
             };
             list.Add(obj);
         }
         return(list);
     }
 }
        public ActionResult PartialCreateCommnet(Comment_Object commentObject, long?carCode)
        {
            var result = new Comment_BCL().InsertOrUpdate(false, commentObject);

            if (result)
            {
                return(RedirectToAction("Index", "CarDetail", new { carCode = carCode }));
            }
            return(View(commentObject));
        }
        public JsonResult CreateComment(Guid postId)
        {
            var commentObject = new Comment_Object
            {
                PostId = postId
            };
            var result = new Comment_BCL().InsertOrUpdate(false, commentObject);

            return(Json(result ? new { rs = true } : new { rs = false }));
        }
Exemplo n.º 4
0
 public bool InsertOrUpdate(bool opt, Comment_Object commentObject)
 {
     using (var db = new CarOnlineEntities())
     {
         var result = db.WEB_CARONLINE_SP_Comment_InsertOrUpdate(opt, commentObject.CommentId,
                                                                 commentObject.PostId, commentObject.UserId, commentObject.ContentComment, commentObject.TotalOfLike,
                                                                 commentObject.CreateDate);
         return(result > 0);
     }
 }
Exemplo n.º 5
0
 public bool InsertOrUpdate(bool opt, Comment_Object commentObject)
 {
     return(new Comment_DAO().InsertOrUpdate(opt, commentObject));
 }