public ActionResult Create([Bind(Include = "CommentID,UserID,ProductID,CommentContent,CreateDate,CreateUser,ModifiedDate,ModifiedUser,IsActive")] Comment comment) { var UserSession = (UserLogin)Session[TechDeviShopVs002.Common.CommonConstants.USER_SESSION]; if (ModelState.IsValid) { var _dal = new CommentDAL(); comment.CreateUser = UserSession.UserID; int id = _dal.Insert(comment); if (id > 0) { return(RedirectToAction("Index", "Comments")); } else { ModelState.AddModelError("", "Thêm bình luận ko thành công"); } } ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", comment.ProductID); ViewBag.ArticleID = new SelectList(db.Articles, "ArticleID", "Title", comment.ArticleID); return(View(comment)); }
public ActionResult ProductComment(int ProductID) { string productComment = String.Format("{0}", Request.Form["CommentContent"]); string CommentName = String.Format("{0}", Request.Form["Name"]); string CommentEmail = String.Format("{0}", Request.Form["Email"]); var pComment = new Comment(); if (ModelState.IsValid) { pComment.ProductID = ProductID; pComment.Email = CommentEmail; pComment.Name = CommentName; pComment.CommentContent = productComment; pComment.IsActive = true; var result = new CommentDAL().Insert(pComment); if (result > 0) { return(RedirectToAction("Detail", "Product", new { id = ProductID })); } else { ModelState.AddModelError("", "Thêm bình luận ko thành công"); } } return(View(pComment)); }
public ActionResult ArticleComment(string CommentContent, string Name, string Email, int ArticleID) { //string productComment = String.Format("{0}", Request.Form["CommentContent"]); //string CommentName = String.Format("{0}", Request.Form["Name"]); //string CommentEmail = String.Format("{0}", Request.Form["Email"]); var pComment = new Comment(); if (ModelState.IsValid) { pComment.ArticleID = ArticleID; pComment.Email = Email; pComment.Name = Name; pComment.CommentContent = CommentContent; pComment.IsActive = true; var result = new CommentDAL().Insert(pComment); if (result > 0) { return(RedirectToAction("Details", "Article", new { id = ArticleID })); } else { ModelState.AddModelError("", "Thêm bình luận ko thành công"); } } return(View(pComment)); }
public CommentBLL FindCommentByCommentID(int CommentID) { CommentBLL ProposedReturnValue = null; CommentDAL DataLayerObject = _context.FindCommentByCommentID(CommentID); if (null != DataLayerObject) { ProposedReturnValue = new CommentBLL(DataLayerObject); } return(ProposedReturnValue); }
public CommentBLL FindCommentByLiked(bool Liked) { CommentBLL ProposedReturnValue = null; CommentDAL DataLayerObject = _context.FindCommentByLiked(Liked); if (null != DataLayerObject) { ProposedReturnValue = new CommentBLL(DataLayerObject); } return(ProposedReturnValue); }
// GET: Admin/Comments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var comment = new CommentDAL().ViewDetail(id); if (comment == null) { return(HttpNotFound()); } return(View(comment)); }
public JsonResult DeleteComment(Guid id) { ProductComment pComment = CommentDAL.Get(x => x.ProductCommentID == id); //foreach (var item in pComment.Product.ProductComments) //{ //} //ProductDAL.Save(); CommentDAL.Delete(pComment); return(Json(true)); }
public Comment GetCommentById(int Id) { try { CommentDAL repository = new CommentDAL(); Comment comment = new Comment(); return(comment = repository.GetCommentById(Id)); } catch (Exception ex) { throw ex; } }
public bool PutComment(Comment comment) { try { CommentDAL repository = new CommentDAL(); bool operation = repository.PutComment(comment); return(operation); } catch (Exception ex) { throw ex; } }
public JsonResult AddCommentJson(string comment, Guid id) { ProductComment _comment = new ProductComment(); _comment.ProductCommentID = Guid.NewGuid(); _comment.IsActive = true; _comment.Content = comment; _comment.CreatedDate = DateTime.Now; _comment.UserID = ((User)Session["user"]).UserID; _comment.ProductID = id; CommentDAL.Add(_comment); return(Json(CommentDAL.GetList(x => x.ProductCommentID == _comment.ProductCommentID).Select(x => new { x.ProductCommentID, x.Content, x.User.FullName, x.CreatedDate }).FirstOrDefault())); }
public List <Comment> GetCollectionComment() { try { CommentDAL repository = new CommentDAL(); List <Comment> comments = new List <Comment>(); return(comments = repository.GetCollectionComment()); } catch (Exception ex) { throw ex; } }
// GET: Admin/Comments/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var comment = new CommentDAL().ViewDetail(id); if (comment == null) { return(HttpNotFound()); } ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", comment.ProductID); ViewBag.ArticleID = new SelectList(db.Articles, "ArticleID", "Title", comment.ArticleID); return(View(comment)); }
/// <summary> /// 获取文档评论及评论会员信息的JSON格式数据 /// </summary> /// <param name="archive"></param> /// <returns></returns> public string GetCommentDetailsJSON(string archiveID) { StringBuilder sb = new StringBuilder(); sb.Append("["); DataTable dt = new CommentDAL().GetCommentsDetailsTable(archiveID); int i = dt.Rows.Count; foreach (DataRow dr in dt.Rows) { sb.Append("{member:{id:").Append(dr["uid"]).Append(",avatar:'") .Append(String.IsNullOrEmpty(dr["avatar"].ToString()) ? "/images/noavatar.gif" : dr["avatar"].ToString()) .Append("',nick:'").Append(dr["nickname"].ToString()) .Append("'},comment:{id:").Append(dr["cid"].ToString()).Append(",txt:'").Append(dr["content"].ToString()) .Append("',time:'").Append(dr["createdate"].ToString()).Append("'}}"); if (dr != dt.Rows[i - 1]) { sb.Append(","); } } sb.Append("]"); return(sb.ToString()); }
public int Comment(McComm mc) { CommentDAL cd = new CommentDAL(); return(cd.Comment(mc)); }
public CommentBLL() { _commentDAL = new CommentDAL(); }
public List <Comment> GetAllComments() { return(CommentDAL.GetAllComments()); }
public int AddComment(Comment comment) { CommentDAL.AddComment(comment); return(CommentDAL.GetLastRowIndex()); }
public void DeleteComment(int id) { CommentDAL.DeleteComment(id); }
public CommentBAL() { commentDal = new CommentDAL(); }
public CommentDTO GetComment(int id) { CommentDAL cmtDAL = new CommentDAL(); return(cmtDAL.GetComment(id)); }
public CompensateBLL() { cDAL = new CompensateDAL(); cmDAL = new CommentDAL(); }
public bool UpdateComment(CommentDTO comment) { CommentDAL cmtDAL = new CommentDAL(); return(cmtDAL.UpdateComment(comment)); }
public bool InsertComment(CommentDTO comment) { CommentDAL cmtDAL = new CommentDAL(); return(cmtDAL.InsertComment(comment)); }
public Comment GetCommentById(int id) { return(CommentDAL.GetCommentById(id)); }
public int CommentReply(McComm mc, int cmID) { CommentDAL cd = new CommentDAL(); return(cd.CommentReply(mc, cmID)); }
public void UpdateComment(Comment comment) { CommentDAL.UpdateComment(comment); }
public DataSet GetAllCommentList() { CommentDAL cd = new CommentDAL(); return(cd.GetAllCommentList()); }
public List <Comment> GetCommentByTaskId(int id) { List <Comment> comments = CommentDAL.GetAllComments(); return(comments.FindAll(c => c.Task == id)); }
public DataSet GetCommentListByMcID(int mcID) { CommentDAL cd = new CommentDAL(); return(cd.GetCommentListByMcID(mcID)); }
/// <summary> /// 获取文档评论及评论会员信息的JSON格式数据 /// </summary> /// <param name="archive"></param> /// <returns></returns> public string GetCommentDetailsJSON(string archiveID) { StringBuilder sb = new StringBuilder(); sb.Append("["); DataTable dt = new CommentDAL().GetCommentsDetailsTable(archiveID); int i=dt.Rows.Count; foreach (DataRow dr in dt.Rows) { sb.Append("{member:{id:").Append(dr["uid"]).Append(",avatar:'") .Append(String.IsNullOrEmpty(dr["avatar"].ToString()) ? "/images/noavatar.gif" : dr["avatar"].ToString()) .Append("',nick:'").Append(dr["nickname"].ToString()) .Append("'},comment:{id:").Append(dr["cid"].ToString()).Append(",txt:'").Append(dr["content"].ToString()) .Append("',time:'").Append(dr["createdate"].ToString()).Append("'}}"); if (dr != dt.Rows[i - 1]) sb.Append(","); } sb.Append("]"); return sb.ToString(); }
public DataSet GetPageCommentListByPdID(int pdID, int pageIndex, int pageSize, out int count) { CommentDAL cd = new CommentDAL(); return(cd.GetPageCommentListByPdID(pdID, pageIndex, pageSize, out count)); }