public ActionResult commentsadd(string comm, string id) { Dictionary <string, Object> map = new Dictionary <string, Object>(); DAO.comments add = new DAO.comments(); string uid = Session["memberID"].ToString(); add.shown = 1; add.mentsname = comm; add.userID = Convert.ToInt32(uid); add.Time = DateTime.Now; MemberBLL mebBll = new MemberBLL(); add.ProductID = Convert.ToInt32(id); bool r = mebBll.adds(add); if (r) { map.Add("data", "1"); return(Json(map, JsonRequestBehavior.AllowGet)); } else { map.Add("data", "0"); return(Json(map, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 添加评论 /// </summary> /// <param name="Model"></param> /// <returns></returns> public bool adds(DAO.comments Model) { DAO.comments commadd = db.comments.Add(Model); int i = db.SaveChanges(); if (i > 0) { return(true); } else { return(false); } }
/// <summary> /// 添加评论 /// </summary> /// <param name="Model"></param> /// <returns></returns> public DAO.comments adds(DAO.comments Model) { DAO.comments commadd = db.comments.Add(Model); int i = db.SaveChanges(); if (i > 0) { return(commadd); } else { return(null); } }