public ActionResult Comment(Product_Comments comment)
 {
     if (ModelState.IsValid)
     {
         comment.CommentID = Guid.NewGuid();
         comment.Date      = DateTime.Now;
         db.Product_Comments.Add(comment);
         db.SaveChanges();
     }
     return(PartialView("ListComment", db.Product_Comments.Where(p => p.ProductID == comment.ProductID && p.ParentID == null)));
 }
Пример #2
0
        public ActionResult CreateComment(Product_Comments productcomments)
        {
            if (ModelState.IsValid)
            {
                productcomments.CreateDate = DateTime.Now;
                db.Products_Comments.Add(productcomments);
                db.SaveChanges();

                return(PartialView("ShowComment", db.Products_Comments.Where(c => c.ProductID == productcomments.ProductID)));
            }
            return(PartialView(productcomments));
        }
Пример #3
0
        public ActionResult CreateComment(Product_Comments productComment)
        {
            //Start CreateComment code
            if (ModelState.IsValid)
            {
                if (User.Identity.IsAuthenticated)
                {
                    productComment.CreateDate = DateTime.Now;
                    productComment.Name       = User.Identity.Name;
                    db.Product_Comments.Add(productComment);
                    db.SaveChanges();
                }


                return(PartialView("ShowComments", db.Product_Comments.Where(c => c.ProductID == productComment.ProductID)));
            }
            return(PartialView(productComment));
        }