public void Add(string content, string authorId, int tutorialId) { var newComment = new Comment { Content = content, AuthorId = authorId, TutorialId = tutorialId }; this.comments.Add(newComment); this.comments.Save(); }
public ActionResult AddComment(string productID, string message) { Comment cm = new Comment(); cm.ID = Guid.NewGuid(); cm.ProductID = new Guid(productID); cm.Username = @User.Identity.Name; cm.Date = DateTime.Now; cm.Comment1 = message; new WCFProductClient().AddComment(cm); return Json("success"); }
public Comment Add(int id, string content) { var newComment = new Comment() { RealEstateId = id, Content = content }; this.comments.Add(newComment); this.comments.SaveChanges(); return newComment; }
public ActionResult AddComment(CommentInputModel model) { if (ModelState.IsValid) { var newComment = new Comment { Content = this.sanitizer.Sanitize(model.Content), CreatedOn = DateTime.UtcNow, AuthorId = this.User.Identity.GetUserId() }; this.comments.Add(newComment); } return this.PartialView("_AllCommentsPartialView", this.GetComments()); }
/// <summary> /// Create a new Comment object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="productID">Initial value of the ProductID property.</param> /// <param name="comment1">Initial value of the Comment1 property.</param> /// <param name="accountID">Initial value of the AccountID property.</param> public static Comment CreateComment(global::System.Int32 id, global::System.Int32 productID, global::System.String comment1, global::System.Int32 accountID) { Comment comment = new Comment(); comment.ID = id; comment.ProductID = productID; comment.Comment1 = comment1; comment.AccountID = accountID; return comment; }
/// <summary> /// Deprecated Method for adding a new object to the Comment EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToComment(Comment comment) { base.AddObject("Comment", comment); }
public ActionResult PostComment(CommentModel model, int pID) { try { if (Session["accountID"] != null) { Rating rating = new Rating(); Rating tempR = new ProductClient().GetRatingByAccountAndProduct((int)Session["accountID"], pID); if (tempR == null) { rating.ProductID = pID; rating.AccountID = (int)Session["accountID"]; rating.Rating1 = model.rating; Comment comment = new Comment(); comment.AccountID = (int)Session["accountID"]; comment.ProductID = pID; comment.Comment1 = model.commnet; new ProductCommentClient().AddComment(comment); new ProductClient().AddRating(rating); return RedirectToAction("PurchaseHistory"); } else { ViewBag.Error = "You already posted a rating for this product."; return View("PostComment", model); } } else { return RedirectToAction("Login", "Login"); } } catch (Exception e) { ViewBag.Error = "An error has occured."; return View("PostComment", model); } }
/// <summary> /// Adds a comment /// </summary> /// <param name="comment">The comment</param> public void AddComment(Comment comment) { new DAProductComment().AddComment(comment); }
public ActionResult PostComment(CommentModel model, int pID) { if (Session["accountID"] != null) { Comment comment = new Comment(); comment.AccountID = (int)Session["accountID"]; comment.ProductID = pID; comment.Comment1 = model.commnet; new ProductCommentClient().AddComment(comment); return RedirectToAction("PurchaseHistory"); } else { return RedirectToAction("Login", "Login"); } }
public void AddComment(Comment c) { entities.AddToComment(c); entities.SaveChanges(); }
/// <summary> /// Create a new Comment object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="productID">Initial value of the ProductID property.</param> /// <param name="username">Initial value of the Username property.</param> /// <param name="comment1">Initial value of the Comment1 property.</param> /// <param name="date">Initial value of the Date property.</param> public static Comment CreateComment(global::System.Guid id, global::System.Guid productID, global::System.String username, global::System.String comment1, global::System.DateTime date) { Comment comment = new Comment(); comment.ID = id; comment.ProductID = productID; comment.Username = username; comment.Comment1 = comment1; comment.Date = date; return comment; }
/// <summary> /// Add a comment to the product /// </summary> /// <param name="c">The comment to be added </param> public void AddComment(Comment c) { new ProductRep().AddComment(c); }
public void AddComment(Comment comment) { entities.Comment.AddObject(comment); entities.SaveChanges(); }