public int CreateComment(TaskCommentModel comment, int userId) { Task task = entities.Tasks.First(t => t.TaskId == comment.TaskId); TaskComment newComment = entities.TaskComments.Create(); newComment.CreatedUserId = userId; newComment.Comment = comment.CommentText; task.TaskComments.Add(newComment); SaveChanges(); return newComment.CommentId; }
public JsonResult CreateComment(TaskCommentModel comment) { return Json(oper.CreateComment(comment, HttpUserData.Get().Id), JsonRequestBehavior.AllowGet); }