コード例 #1
0
        public ActionResult CreateCommentSave(club_postcomment model)
        {
            string result;

            if (ModelState.IsValid)
            {
                if (model.Comment == null || (Session["memberinfo"] == null && model.WriterName == null))
                {
                    result = "<font color=red>Boş bıraktığınız alan var..</font>";
                }
                else
                {
                    model.WritingDate = DateTime.Now;
                    if (Session["memberinfo"] == null)
                    {
                        model.IsApproval = false;
                        result           = "<font color=green>Yorumunuz başarıyla kaydedildi.. Onaylandıktan sonra yayınlanacak..</font><script typr=\"text/javascript\">setTimeout(function (){ ToggleCommentBar(); }, 2000);</script>";
                    }
                    else
                    {
                        model.IsApproval = true;
                        result           = "<font color=green>Yorumunuz başarıyla yayınlandı..</font><script typr=\"text/javascript\">setTimeout(function (){ window.location.reload(); }, 2000);</script>";
                    }
                    Db.club_postcomment.Add(model);
                    Db.SaveChanges();
                }
            }
            else
            {
                result = "<font color=red>Boş alan bıraktınız. Tekrar deneyin.</font>";
            }
            return(Content(result));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int num)
        {
            club_postcomment comment = Db.club_postcomment.Find(num);

            Db.club_postcomment.Remove(comment);
            Db.SaveChanges();
            return(RedirectToAction("index"));
        }
コード例 #3
0
        public ActionResult Details(int num = 0)
        {
            club_postcomment comment = Db.club_postcomment.Find(num);

            if (comment == null)
            {
                return(HttpNotFound());
            }
            return(View(comment));
        }
コード例 #4
0
 public ActionResult Edit(club_postcomment comment)
 {
     if (ModelState.IsValid)
     {
         Db.Entry(comment).State = EntityState.Modified;
         Db.SaveChanges();
         return(RedirectToAction("index"));
     }
     ViewBag.PostId = new SelectList(Db.club_post, "Id", "Title");
     return(View(comment));
 }
コード例 #5
0
        public ActionResult Edit(int num = 0)
        {
            club_postcomment comment = Db.club_postcomment.Find(num);

            if (comment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PostId = new SelectList(Db.club_post, "Id", "Title");
            return(View(comment));
        }
コード例 #6
0
 public ActionResult Create(club_postcomment comment)
 {
     if (ModelState.IsValid)
     {
         comment.MemberId    = (int)Session["memberid"];
         comment.WritingDate = DateTime.Now;
         Db.club_postcomment.Add(comment);
         Db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PostId = new SelectList(Db.club_post, "Id", "Title");
     return(View(comment));
 }
コード例 #7
0
        public ActionResult ChangeApproval(int num = 0)
        {
            string           result  = "";
            club_postcomment comment = Db.club_postcomment.Find(num);

            if (comment != null)
            {
                if (comment.IsApproval == true)
                {
                    comment.IsApproval = false;
                    result             = "Yorum onayı başarıyla kaldırıldı.";
                }
                else
                {
                    comment.IsApproval = true;
                    result             = "Yorum başarıyla onaylandı.";
                }
                Db.SaveChanges();
            }
            return(Content("<script type=\"text/javascript\">SuccessInfo('" + result + "');</script>"));
        }