Esempio n. 1
0
        public ActionResult AddReview(Review review)
        {
            UserRepo userrepo = new UserRepo();

            review.User    = userrepo.GetUserById(Convert.ToInt32(Request.Form["userid"])) as User;
            review.Product = productrepo.GetProductById(Convert.ToInt32(Request.Form["productid"])) as Product;
            review.Rating  = Convert.ToInt32(Request.Form["rating"]);
            review.Message = Request.Form["message"].ToString();

            string message = null;

            message = productrepo.AddReview(review);

            if (message == "Success")
            {
                return(RedirectToAction("Details", new { id = review.Product.ProductId }));
            }
            else
            {
                return(RedirectToAction("Details", new { id = review.Product.ProductId }));
            }
        }