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