Example #1
0
        public ActionResult DeleteConfirmed(string id)
        {
            Pengumuman pengumuman = db.Pengumuman.Find(id);

            db.Pengumuman.Remove(pengumuman);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,Title,Content,DateCreated,DatePublished")] Pengumuman pengumuman)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pengumuman).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pengumuman));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "Title,Content")] Pengumuman pengumuman)
        {
            if (ModelState.IsValid)
            {
                pengumuman.DateCreated = DateTime.Now;
                db.Pengumuman.Add(pengumuman);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pengumuman));
        }
Example #4
0
        // GET: Admin/Pengumuman/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pengumuman pengumuman = db.Pengumuman.Find(id);

            if (pengumuman == null)
            {
                return(HttpNotFound());
            }
            return(View(pengumuman));
        }
Example #5
0
        // GET: Admin/Pengumuman/Edit/5
        public ActionResult Edit(int id)
        {
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}
            Pengumuman pengumuman = db.Pengumuman.Find(id);

            if (pengumuman == null)
            {
                return(HttpNotFound());
            }
            return(View(pengumuman));
        }