public async Task <ActionResult> DeleteConfirmed(int id) { StaffNotice staffNotice = await db.StaffNotices.FindAsync(id); db.StaffNotices.Remove(staffNotice); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "id,Notice,Type")] StaffNotice staffNotice) { if (ModelState.IsValid) { db.Entry(staffNotice).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(staffNotice)); }
public async Task <ActionResult> Create([Bind(Include = "id,Notice,Type")] StaffNotice staffNotice) { if (ModelState.IsValid) { db.StaffNotices.Add(staffNotice); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(staffNotice)); }
// GET: StaffNotices/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StaffNotice staffNotice = await db.StaffNotices.FindAsync(id); if (staffNotice == null) { return(HttpNotFound()); } return(View(staffNotice)); }