예제 #1
0
        public JsonResult putComment(int id, JobCardComment comment)
        {
            var user_comment = cs.Comments.FirstOrDefault(x => x.CommentID == id);

            if (user_comment != null)
            {
                user_comment.modified = comment.modified;
                user_comment.content  = comment.content;
                user_comment.Parent   = comment.parent;
                cs.SaveChanges();

                return(Json(/*json*/ comment, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public JsonResult postComment(JobCardComment comment)
        {
            var jobCard = cs.JobCards.FirstOrDefault(x => x.JobCardId == comment.id);

            if (jobCard != null)
            {
                Comment c = new Comment
                {
                    content  = comment.content,
                    Parent   = comment.parent,
                    modified = comment.modified,
                    created  = comment.created,
                    fullname = comment.fullname
                };
                cs.Comments.Add(c);
                jobCard.Commentts.Add(c);
                cs.SaveChanges();
                return(Json(comment, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }