public ActionResult AddRepl(BinhLuan Comment)
        {
            Comment.NgayDang = DateTime.Now;
            Comment.MaKH     = User.Identity.GetUserId();
            CommentModel cm = new CommentModel();

            cm.AddComment(Comment);
            cm.UpdateComment(Comment);
            return(RedirectToAction("TimBinhLuan"));
        }
        public ActionResult AddComment(BinhLuan Comment)
        {
            Comment.NgayDang = DateTime.Now;
            Comment.MaKH     = User.Identity.GetUserId();
            Comment.DaTraLoi = "C";
            CommentModel cm = new CommentModel();

            cm.AddComment(Comment);
            return(RedirectToAction("LoadComment", new { masp = Comment.MaSP }));
        }
Beispiel #3
0
        public ActionResult AddComment(CommentModel objCommentModel)
        {
            CommentModel objcomment = new CommentModel();
            int          id         = objcomment.AddComment(objCommentModel);

            var result = objcomment.GetCommentById(Convert.ToInt32(objCommentModel.Blog_Id));

            SendEmailToUser(id);
            //   SendEmail(id);
            // return Json(JsonRequestBehavior.AllowGet);

            return(PartialView("~/Views/Blog/_Comment.cshtml", result));
        }
Beispiel #4
0
 public static string ADDComment(string fullname = "", string Email = "", string Text = "", string blogid = "")
 {
     if (blogid != "")
     {
         int          id         = Convert.ToInt32(blogid);
         CommentModel objComment = new CommentModel();
         int          ids        = objComment.AddComment(fullname, Email, Text, id);
         ShowBlog     objblog    = new ShowBlog();
         objblog.sendemail(ids);
         return("Comment Added Succesfully");
     }
     else
     {
         return("Comment Not Added Succesfully");
     }
 }
Beispiel #5
0
        public ActionResult AddRepl(BinhLuan Comment)
        {
            Comment.NgayDang = DateTime.Now;
            Comment.MaKH     = User.Identity.GetUserId();
            Comment.HoTen    = User.Identity.Name;
            if (User.IsInRole("Nhân viên"))
            {
                Comment.Email = "Nhân viên";
            }
            else
            {
                Comment.Email = "Quản trị viên";
            }
            CommentModel cm = new CommentModel();

            cm.AddComment(Comment);
            cm.UpdateComment(Comment);
            return(RedirectToAction("TimBinhLuan"));
        }
Beispiel #6
0
        public ActionResult AddComment(BinhLuan Comment)
        {
            CommentModel cm = new CommentModel();

            Comment.NgayDang = DateTime.Now;
            if (User.Identity.GetUserId() != null)
            {
                Comment.MaKH  = User.Identity.GetUserId();
                Comment.HoTen = cm.GetUser(User.Identity.GetUserId()).HoTen.ToString();
                Comment.Email = cm.GetUser(User.Identity.GetUserId()).Email.ToString();
            }
            Comment.DaTraLoi = "C";
            cm.AddComment(Comment);

            //Chatbot rep
            Chatbot bot = new Chatbot();

            bot.ChatbotRep(Comment);
            return(RedirectToAction("LoadComment", new { masp = Comment.MaSP }));
        }
Beispiel #7
0
 public ActionResult AddComment(CommentModel comment)
 {
     comment.Author = User.Identity.Name.ToString();
     comment.Time   = DateTime.Now;
     if (ModelState.IsValid)
     {
         if (comment.AddComment())
         {
             CommentModel.Comments.Add(comment);
             ViewData["List"] = CommentModel.Comments;
             ModelState.Clear();
             logger.Info("Добавлен комментарий пользователя: " + comment.Author + " к посту: " + comment.Post_ID);
             if (Request.IsAjaxRequest())
             {
                 return(RedirectToAction("AddComment", "Comment", new { Post_Id = comment.Post_ID }));
             }
             return(RedirectToAction("Posts", "Post", new { Id = comment.Post_ID }));
         }
         else
         {
             logger.Error("ошибка добавления комментария пользователя: " + comment.Author + " к посту: " + comment.Post_ID);
             ViewData["List"] = CommentModel.Comments;
             if (Request.IsAjaxRequest())
             {
                 return(RedirectToAction("AddComment", "Comment", new { Post_Id = comment.Post_ID }));
             }
             return(RedirectToAction("Posts", "Post", new { Id = comment.Post_ID }));
         }
     }
     else
     {
         ViewData["List"] = CommentModel.Comments;
         if (Request.IsAjaxRequest())
         {
             return(RedirectToAction("AddComment", "Comment", new { Post_Id = comment.Post_ID }));
         }
         return(RedirectToAction("Posts", "Post", new { Id = comment.Post_ID }));
     }
 }
Beispiel #8
0
        protected void btnAddComment_Click(object sender, EventArgs e)
        {
            if (txtCommentContent.Text.Length > 10)
            {
                commentLogic = new CommentModel();
                int AddedCommentID = commentLogic.AddComment(Convert.ToInt32(Session["UserID"]), DocID, 0, txtCommentContent.Text);

                if (AddedCommentID != 0)
                {
                    blInfo.Items.Add("Thêm bình luận thành công");
                    LoadComment(DocID);
                    txtCommentContent.Text = "";
                }
                else
                {
                    blInfo.Items.Add("Có lỗi trong quá trình xử lí. Vui lòng thử lại sau");
                }
            }
            else
            {
                blInfo.Items.Add("Bình luận tối thiểu 10 kí tự");
            }
        }