public ActionResult PostComment(int pID)
 {
     Product p = new ProductClient().GetProductByID(pID);
     CommentModel cm = new CommentModel();
     cm.myProduct = p;
     return View(cm);
 }
        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);
            }
        }
        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");
            }
        }