public ActionResult Edit(Notice notice) { if (ModelState.IsValid) { db.Entry(notice).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(notice); }
public ActionResult Create(Notice notice) { if (ModelState.IsValid) { notice.AddDate = DateTime.Now; db.Notices.Add(notice); db.SaveChanges(); return RedirectToAction("Index"); } return View(notice); }