//详情 public ActionResult Detail(int id, int classid) { var good = GoodsManage.Getgood(id); var classif = GoodsManage.FindAllBooks().Where(p => p.Classify_id == classid); var Comment = CommentGoodsManage.findallcomment(id); var userid = Convert.ToInt32(Session["User_id"]); ViewModels.GoodsDetail index = new GoodsDetail(); if (userid > 0) { var carts = CartManage.Findusercart(userid); index.Carts1 = carts; } if (good == null) { return(HttpNotFound()); } if (classif == null) { return(HttpNotFound()); } if (Comment == null) { return(HttpNotFound()); } index.Goodss = good; index.Goods11 = classif; index.Comment1 = Comment; return(View(index)); //return View(); }
public ActionResult SelectReply(int commendid) { var replydf = CommentGoodsManage.findallreply(commendid); ViewModels.GoodsDetail der = new GoodsDetail(); der.Reply1 = replydf; return(View(der)); }
public ActionResult Reply(ReplyGoods repgoods) { string reply = Request["replaygoods"]; int commid = Convert.ToInt32(Request["commendid"]); int userid = Convert.ToInt32(Session["User_id"]); var replylist = CommentGoodsManage.findallreply(commid); if (reply == null) { return(Content("<script>;alert('回复内容不能为空!');history.go(-1)</script>")); } else if (ModelState.IsValid) { repgoods.CommentGoods_id = commid; repgoods.User_id = userid; repgoods.Content = reply; repgoods.ReplyTime = DateTime.Now; CommentGoodsManage.addReplyGoods(repgoods); return(Content("<script>;alert('回复成功!');history.go(-1)</script>")); } return(RedirectToAction("Detail", "Malls")); }
public ActionResult addComment(CommentGoods comgoods) { string content = Request["detail-goods-comment"]; int goodsid = int.Parse(Request["detail-goodsName"].ToString()); int userid = int.Parse(Session["User_id"].ToString()); if (content == null || content.Length == 0) { return(Content("<script>;alert('评论内容不能为空!');history.go(-1)</script>")); } else if (ModelState.IsValid) { comgoods.User_id = userid; comgoods.Goods_id = goodsid; comgoods.Content = content; comgoods.CommentTime = DateTime.Now; CommentGoodsManage.AddCommentGoods(comgoods); return(Content("<script>;alert('评论成功!');history.go(-1)</script>")); } return(RedirectToAction("Detail", "Malls")); }