public ActionResult NewComment(StructureComment cmtData)
 {
     cmtData.userid = Convert.ToInt32(Session["uid"]);
     cmtData.postid = Convert.ToInt32(TempData["postIdFromDetails"]);
     //gồm nội dung comment và id người gửi + id bài post...
     PostBLL.Post_CreateNewComment(cmtData);
     return(RedirectToAction("Index", "Home"));
 }
 public ActionResult NewComment(StructureComment cmtData)
 {
     //gồm nội dung comment và id người gửi + id bài post...
     if (cmtData.anonymous != null)
     {
         cmtData.anonymous = true;
     }
     else
     {
         cmtData.anonymous = false;
     }
     PostBLL.Post_CreateNewComment(cmtData);
     return(RedirectToAction("Detail", "Post"));
 }
Пример #3
0
 public bool CreateNewComment(StructureComment cmtData)
 {
     try
     {
         Comment cmt = new Comment()
         {
             anonymous = cmtData.anonymous == "on",
             Date      = DateTime.Now,
             Content   = cmtData.Content,
             postid    = cmtData.postid,
             userid    = cmtData.userid
         };
         db.Comments.Add(cmt);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Пример #4
0
 public static bool Post_CreateNewComment(StructureComment cmtData)
 {
     return(pstDAL.CreateNewComment(cmtData));
 }