コード例 #1
0
ファイル: Pic_CommentController.cs プロジェクト: CHIclay/SEE
        public ActionResult Comments(Pic_Comment piccomment)
        {
            if (Session["UID"] != null)
            {
                string textarea = Request["textarea"];
                int    Pic_ID   = Convert.ToInt32(Request["picid"]);
                Session["Pic_ID"] = Pic_ID;
                if (ModelState.IsValid)
                {
                    piccomment.Pic_ID  = Pic_ID;
                    piccomment.UID     = Convert.ToInt32(Session["UID"].ToString());
                    piccomment.PC_Mes  = textarea;
                    piccomment.PC_Time = DateTime.Now;
                    db.Pic_Comment.Add(piccomment);
                    db.SaveChanges();
                    return(Content("<script>alert('评论成功!');window.open('" + Url.Action("Details", "Picture", new { id = Pic_ID }) + "','_self');</script>"));
                }
            }
            else
            {
                return(Content("<script>;alert('你还没有登陆哦!');history.go(-1)</script>"));
            }

            return(RedirectToAction("Details", "Picture"));
        }
コード例 #2
0
ファイル: Pic_CommentController.cs プロジェクト: CHIclay/SEE
        public ActionResult Delete(int id)
        {
            Pic_Comment pc = db.Pic_Comment.Find(id);

            db.Pic_Comment.Remove(pc);
            db.SaveChanges();
            return(Content("<script>alert('删除成功!');window.open('" + Url.Action("Index", "Pic_Comment") + "','_self');</script>"));
        }