public ActionResult PostComment(FormCollection form) { if (Session["userID"] == null) return RedirectToAction("Login", "User", new { id = Convert.ToInt32(form["contractorUserID"]) }); ReviewComment comment = new ReviewComment(); comment.userID = (int)Session["userID"]; comment.reviewID = Convert.ToInt32(form["reviewID"]); comment.comment = form["comment"]; if (ModelState.IsValid) comment.Save(); // Otherwise, reshow form return RedirectToAction("Review", "User", new { id = comment.reviewID }); }
/// <summary> /// Deprecated Method for adding a new object to the ReviewComments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToReviewComments(ReviewComment reviewComment) { base.AddObject("ReviewComments", reviewComment); }
/// <summary> /// Create a new ReviewComment object. /// </summary> /// <param name="reviewCommentID">Initial value of the reviewCommentID property.</param> /// <param name="userID">Initial value of the userID property.</param> /// <param name="reviewID">Initial value of the reviewID property.</param> /// <param name="comment">Initial value of the comment property.</param> public static ReviewComment CreateReviewComment(global::System.Int32 reviewCommentID, global::System.Int32 userID, global::System.Int32 reviewID, global::System.String comment) { ReviewComment reviewComment = new ReviewComment(); reviewComment.reviewCommentID = reviewCommentID; reviewComment.userID = userID; reviewComment.reviewID = reviewID; reviewComment.comment = comment; return reviewComment; }