public PartialViewResult NewComment(Guid reportId) { var newComment = new Comment(); newComment.ReportID = reportId; return PartialView("_NewComment", newComment); }
/// <summary> /// Create a new Comment object. /// </summary> /// <param name="commentID">Initial value of the CommentID property.</param> /// <param name="userID">Initial value of the UserID property.</param> /// <param name="reportID">Initial value of the ReportID property.</param> /// <param name="content">Initial value of the Content property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> public static Comment CreateComment(global::System.Guid commentID, global::System.String userID, global::System.Guid reportID, global::System.String content, global::System.DateTime createDate) { Comment comment = new Comment(); comment.CommentID = commentID; comment.UserID = userID; comment.ReportID = reportID; comment.Content = content; comment.CreateDate = createDate; return comment; }
/// <summary> /// Deprecated Method for adding a new object to the Comments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToComments(Comment comment) { base.AddObject("Comments", comment); }
public ActionResult PostComment(Comment model) { var db = new ChwinockEntities(); model.CommentID = Guid.NewGuid(); model.CreateDate = DateTime.UtcNow; db.Comments.AddObject(model); db.SaveChanges(); return RedirectToAction("Index"); }