public ActionResult Edit(Article article) { if (ModelState.IsValid) { db.Entry(article).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(article); }
public ActionResult Create(Article article) { if (ModelState.IsValid) { article.Posted = DateTime.Now; article.Read = 0; article.Like = 0; db.Articles.Add(article); db.SaveChanges(); return RedirectToAction("Index"); } return View(article); }