public ActionResult DeleteConfirmed(string id) { Pengumuman pengumuman = db.Pengumuman.Find(id); db.Pengumuman.Remove(pengumuman); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
// 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)); }
// 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)); }