Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            InfoComment infoComment = db.InfoComment.Find(id);

            db.InfoComment.Remove(infoComment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        // GET: InfoComments/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            InfoComment infoComment = db.InfoComment.Find(id);

            if (infoComment == null)
            {
                return(HttpNotFound());
            }
            return(View(infoComment));
        }
Exemplo n.º 3
0
 public ActionResult InfoComment()
 {
     if (ModelState.IsValid)
     {
         string      commentcontent   = Request.Form["comment-text"];
         int         infoid           = Convert.ToInt32(Session["infoid"]);
         InfoComment infocommentmodel = new InfoComment();
         infocommentmodel.UserInfo_ID = Convert.ToInt32(Session["user_ID"]);
         infocommentmodel.Info_ID     = infoid;
         infocommentmodel.IC_Time     = System.DateTime.Now;
         infocommentmodel.IC_Content  = commentcontent;
         var have = InfoCommentBll.Add(infocommentmodel);
         if (have == true)
         {
             return(Content("<script>;alert('评论成功!');history.go(-1)</script>"));
         }
     }
     return(RedirectToAction("Info_Details", "Info"));
 }