public ActionResult InsertComment(int pstid) { ViewBag.idp = pstid; return PartialView(); } [HttpPost] public ActionResult InsertComment(Comment cmnt) { if (Session["Captcha"] == null || Session["Captcha"].ToString() != cmnt.Capcha) { //ModelState.Clear(); //Session.Clear(); return MessageBox.Show("کد امنیتی درست نمی باشد!", MessageType.Alert, true); } CommentRepository rpCmnt = new CommentRepository(); if (ModelState.IsValid) { cmnt.Date = DateTime.Now.ToPersianDate().ToShortDateString(); cmnt.Time = DateTime.Now.ToPersianDate().ToShortTimeString(); cmnt.Is_show = false; cmnt.Likes = 0; cmnt.UnLikes = 0; //cmnt.id_post = pstid; if (rpCmnt.Add(cmnt)) { return MessageBox.Show("دیدگاه شما به درستی درج شد", MessageType.Success, true); } else { return MessageBox.Show("دیدگاه شما به درستی درج نشد", MessageType.Success, true); } } else { return MessageBox.Show(ModelState.GetErrors(), MessageType.Warning, true); } }
@Html.Action("InsertComment", "Home", new { pstid = Model.oPost.ID });