コード例 #1
0
        public ActionResult Delete(int id)
        {
            Album_Comment ac = db.Album_Comment.Find(id);

            db.Album_Comment.Remove(ac);
            db.SaveChanges();
            return(Content("<script>alert('删除成功!');window.open('" + Url.Action("Index", "Album_Comment") + "','_self');</script>"));
        }
コード例 #2
0
 public ActionResult AC_Add(Album_Comment album_comment)
 {
     if (Session["UID"] != null)
     {
         string acmes  = Request["acmes"];
         int    alb_id = Convert.ToInt32(Request["albid"]);
         if (ModelState.IsValid)
         {
             album_comment.Alb_ID  = alb_id;
             album_comment.UID     = Convert.ToInt32(Session["UID"].ToString());
             album_comment.AC_Mes  = acmes;
             album_comment.AC_Time = System.DateTime.Now;
             db.Album_Comment.Add(album_comment);
             db.SaveChanges();
             return(Content("<script>alert('评论成功!');window.open('" + Url.Action("Details", "Album", new { id = alb_id }) + "','_self');</script>"));
         }
         return(RedirectToAction("Details", "Album"));
     }
     else
     {
         return(Content("<script>;alert('你还没有登陆哦!');history.go(-1)</script>"));
     }
 }