public ActionResult Create(Announcement announcement) { if (ModelState.IsValid) { db.Announcements.Add(announcement); db.SaveChanges(); return RedirectToAction("Index"); } return View(announcement); }
public ActionResult Edit(Announcement announcement) { if (ModelState.IsValid) { db.Entry(announcement).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(announcement); }