Ejemplo n.º 1
0
        public ActionResult Comments(GoodsComments GoodsComments)
        {
            int    goodid   = Convert.ToInt32(Session["goodid"]);
            int    userid   = Convert.ToInt32(Session["UserID"]);
            string textarea = Request["pingluntextarea"];
            var    result   = orderitemsmanager.GoodCommentOrder(userid, goodid);

            if (ModelState.IsValid)
            {
                if (result > 0)
                {
                    if (textarea != "")
                    {
                        GoodsComments.UserID              = Convert.ToInt32(Session["UserID"]);
                        GoodsComments.GoodsID             = goodid;
                        GoodsComments.PublishTime         = System.DateTime.Now;
                        GoodsComments.GoodsCommentContent = textarea;
                        goodscommentsmanager.InsertGoodsComment(GoodsComments);
                        return(Content("<script>alert('评论成功');window.open('" + Url.Action("GoodsDetail", "Goods", new { goodid = goodid }) + "', '_self')</script>"));
                    }
                    else
                    {
                        return(Content("<script>alert('评论不能为空!');history.go(-1)</script>"));
                    }
                }
                else
                {
                    return(Content("<script>alert('您未购买此商品,不能评论!');history.go(-1)</script>"));
                }
            }
            return(RedirectToAction("GoodsDetail", "Goods", new { goodid = goodid }));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            GoodsComments goodsComments = db.GoodsComments.Find(id);

            db.GoodsComments.Remove(goodsComments);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "GoodsCommentID,UserID,GoodsID,GoodsCommentContent,PublishTime")] GoodsComments goodsComments)
 {
     if (ModelState.IsValid)
     {
         db.Entry(goodsComments).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GoodsID = new SelectList(db.Goods, "GoodsID", "GoodsName", goodsComments.GoodsID);
     ViewBag.UserID  = new SelectList(db.Users, "UserID", "UserName", goodsComments.UserID);
     return(View(goodsComments));
 }
Ejemplo n.º 4
0
        // GET: GoodsComManagement/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GoodsComments goodsComments = db.GoodsComments.Find(id);

            if (goodsComments == null)
            {
                return(HttpNotFound());
            }
            return(View(goodsComments));
        }
Ejemplo n.º 5
0
        // GET: GoodsComManagement/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GoodsComments goodsComments = db.GoodsComments.Find(id);

            if (goodsComments == null)
            {
                return(HttpNotFound());
            }
            ViewBag.GoodsID = new SelectList(db.Goods, "GoodsID", "GoodsName", goodsComments.GoodsID);
            ViewBag.UserID  = new SelectList(db.Users, "UserID", "UserName", goodsComments.UserID);
            return(View(goodsComments));
        }
Ejemplo n.º 6
0
 public void InsertGoodsComment(GoodsComments goodscomment)
 {
     igoodscomments.InsertGoodsComments(goodscomment);
 }
Ejemplo n.º 7
0
 public void InsertGoodsComments(GoodsComments goodscomments)
 {
     db.GoodsComments.Add(goodscomments);
     db.SaveChanges();
 }