Ejemplo n.º 1
0
 public ActionResult AddNotice([Bind(Include = "announce_id, announce_title, announce_content, announce_publish_time")] tb_announcement tb_announcement)
 {
     tb_announcement.announce_title        = HttpContext.Request.Form["title"];
     tb_announcement.announce_content      = HttpContext.Request.Form["content"];
     tb_announcement.announce_publish_time = DateTime.Now.GetDateTimeFormats('M')[0].ToString();
     db.tb_announcement.Add(tb_announcement);
     db.SaveChanges();
     return(Redirect("Notice?page=1"));
 }
Ejemplo n.º 2
0
        public ActionResult DeleteNotice(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tb_announcement announce = db.tb_announcement.Find(id);

            if (announce == null)
            {
                return(HttpNotFound());
            }
            db.tb_announcement.Remove(announce);
            db.SaveChanges();
            return(Redirect("Notice?page=1"));
        }